looks good

This commit is contained in:
shenjack 2024-06-10 22:08:37 +08:00
parent b3e9588763
commit 7fbe91e55e
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use crate::data_struct::tailchat::UserId; use crate::data_struct::tailchat::UserId;

View File

@ -4,7 +4,8 @@ use rust_socketio::{Event, Payload};
use tracing::info; use tracing::info;
use crate::data_struct::tailchat::messages::ReciveMessage; 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) { 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 Payload::Text(values) = payload {
if let Some(value) = values.first() { 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());
} }
} }
} }