Commit 2c4486be authored by xuwencheng's avatar xuwencheng

store

parent 90cc2025
...@@ -116,7 +116,6 @@ pub trait ConnectEvent { ...@@ -116,7 +116,6 @@ pub trait ConnectEvent {
fn connect( fn connect(
info: &TokenInfo, info: &TokenInfo,
status: Status, status: Status,
desc: impl AsRef<str>,
extra: Option<impl AsRef<str>>, extra: Option<impl AsRef<str>>,
) -> SocketEvent; ) -> SocketEvent;
...@@ -127,9 +126,13 @@ impl ConnectEvent for SocketEvent { ...@@ -127,9 +126,13 @@ impl ConnectEvent for SocketEvent {
fn connect( fn connect(
info: &TokenInfo, info: &TokenInfo,
status: Status, status: Status,
desc: impl AsRef<str>,
extra: Option<impl AsRef<str>>, extra: Option<impl AsRef<str>>,
) -> SocketEvent { ) -> SocketEvent {
let desc = if status.eq(&Status::Success) {
"设备建立连接"
} else {
"设备断开连接"
};
SocketEvent { SocketEvent {
seller_id: Some(info.seller_id), seller_id: Some(info.seller_id),
store_id: Some(info.seller_id), store_id: Some(info.seller_id),
...@@ -144,7 +147,7 @@ impl ConnectEvent for SocketEvent { ...@@ -144,7 +147,7 @@ impl ConnectEvent for SocketEvent {
msg_id: None, msg_id: None,
msg_ty: None, msg_ty: None,
status: status as i32, status: status as i32,
desc: desc.as_ref().to_string(), desc: desc.to_string(),
extra: extra.map(|s| s.as_ref().to_string()), extra: extra.map(|s| s.as_ref().to_string()),
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment