From 7fbe91e55e5ec8afd0a517dcd1ec64d50346dfa0 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 10 Jun 2024 22:08:37 +0800 Subject: [PATCH] looks good --- ica-rs/src/data_struct/tailchat/status.rs | 1 - ica-rs/src/tailchat/events.rs | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ica-rs/src/data_struct/tailchat/status.rs b/ica-rs/src/data_struct/tailchat/status.rs index 90bfba5..8041faa 100644 --- a/ica-rs/src/data_struct/tailchat/status.rs +++ b/ica-rs/src/data_struct/tailchat/status.rs @@ -1,5 +1,4 @@ use serde::{Deserialize, Serialize}; -use serde_json::Value as JsonValue; use crate::data_struct::tailchat::UserId; diff --git a/ica-rs/src/tailchat/events.rs b/ica-rs/src/tailchat/events.rs index 3f13ca4..85647c6 100644 --- a/ica-rs/src/tailchat/events.rs +++ b/ica-rs/src/tailchat/events.rs @@ -4,7 +4,8 @@ use rust_socketio::{Event, Payload}; use tracing::info; use crate::data_struct::tailchat::messages::ReciveMessage; -use crate::tailchat::client::send_message; +use crate::data_struct::tailchat::status::UpdateDMConverse; +use crate::tailchat::client::{emit_join_room, send_message}; /// 所有 pub async fn any_event(event: Event, payload: Payload, _client: Client) { @@ -93,10 +94,19 @@ pub async fn on_msg_delete(payload: Payload, _client: Client) { } } -pub async fn on_converse_update(payload: Payload, _client: Client) { +pub async fn on_converse_update(payload: Payload, client: Client) { if let Payload::Text(values) = payload { if let Some(value) = values.first() { - info!("更新会话 {}", value.to_string().green()); + emit_join_room(&client).await; + let update_info: UpdateDMConverse = match serde_json::from_value(value.clone()) { + Ok(value) => value, + Err(e) => { + info!("tailchat updateDMConverse {}", value.to_string().red()); + info!("tailchat updateDMConverse {}", format!("{:?}", e).red()); + return; + } + }; + info!("更新会话 {}", format!("{:?}", update_info).cyan()); } } }