会话列表排序

This commit is contained in:
2025-12-05 15:24:38 +08:00
parent 83bb3a2daa
commit 9c888f9966
2 changed files with 3 additions and 1 deletions

View File

@@ -242,12 +242,14 @@ class MessageController extends ApiController
// 如果是别人发的显示昵称 // 如果是别人发的显示昵称
$msg = $chat_user['nick_name'] . '' . $lastMsg['content']; $msg = $chat_user['nick_name'] . '' . $lastMsg['content'];
} }
$data[$k]['send_time_origin'] = $lastMsg['send_time'];
$data[$k]['send_time'] = formatWeChatTime($lastMsg['send_time']); $data[$k]['send_time'] = formatWeChatTime($lastMsg['send_time']);
} }
$data[$k]['msg'] = $msg; $data[$k]['msg'] = $msg;
$data[$k]['unread_count'] = $unreadCount; $data[$k]['unread_count'] = $unreadCount;
$data[$k]['is_th'] = ChatGroup::isTh($session['group_id'], $this->uid); $data[$k]['is_th'] = ChatGroup::isTh($session['group_id'], $this->uid);
} }
$data = param_sort($data, 'send_time_origin');
return $this->success(['list' => $data]); return $this->success(['list' => $data]);
} }

View File

@@ -17,6 +17,7 @@ namespace extend\chat\model;
public static $user_info; public static $user_info;
public function handles($client_id, $message) public function handles($client_id, $message)
{ {
Log::info('收到聊天消息----' . json_encode($message));
if(empty($message['type']) || empty($message['operate_type']) || empty($message['token'])) { if(empty($message['type']) || empty($message['operate_type']) || empty($message['token'])) {
Gateway::sendToClient($client_id, json_encode(['msg' => 'type/operate_type/token参数必传'])); Gateway::sendToClient($client_id, json_encode(['msg' => 'type/operate_type/token参数必传']));
return; return;
@@ -51,7 +52,6 @@ namespace extend\chat\model;
return; return;
} }
} }
Log::info('收到聊天消息----' . json_encode($message));
call_user_func_array(['extend\chat\model\\' . $message['type'], $message['operate_type']], [$client_id, $message]); call_user_func_array(['extend\chat\model\\' . $message['type'], $message['operate_type']], [$client_id, $message]);
} }