diff --git a/app/Amqp/Consumer/ChatMessageConsumer.php b/app/Amqp/Consumer/ChatMessageConsumer.php index c8274fc..88a90b1 100644 --- a/app/Amqp/Consumer/ChatMessageConsumer.php +++ b/app/Amqp/Consumer/ChatMessageConsumer.php @@ -378,9 +378,9 @@ class ChatMessageConsumer extends ConsumerMessage private function formatTalkMessage(array $data): array { $message = [ - "id" => 0,// 消息记录ID - "source" => 1,// 消息来源[1:好友私信;2:群聊] - "msg_type" => 1, + "id" => 0, // 消息记录ID + "source" => 1, // 消息来源[1:好友私信;2:群聊] + "msg_type" => 1, // 消息类型 "user_id" => 0, // 发送者用户ID "receive_id" => 0, // 接收者ID[好友ID或群ID] "content" => '',// 文本消息 diff --git a/app/Bootstrap/ServerStart.php b/app/Bootstrap/ServerStart.php index 4a42973..7d6d9f2 100644 --- a/app/Bootstrap/ServerStart.php +++ b/app/Bootstrap/ServerStart.php @@ -25,9 +25,6 @@ use Hyperf\Redis\Redis; */ class ServerStart extends ServerStartCallback { - /** - * 回调事件 - */ public function beforeStart() { stdout_log()->info(sprintf('服务运行ID : %s', SERVER_RUN_ID)); diff --git a/app/Controller/Api/V1/TalkController.php b/app/Controller/Api/V1/TalkController.php index f6b776a..3900e73 100644 --- a/app/Controller/Api/V1/TalkController.php +++ b/app/Controller/Api/V1/TalkController.php @@ -129,12 +129,14 @@ class TalkController extends CController ]; if ($result['type'] == 1) { - $data['unread_num'] = $this->unreadTalkCache->get($user_id, $result['friend_id']); - $userInfo = User::where('id', $user_id)->first(['nickname', 'avatar']); + $userInfo = User::where('id', $user_id)->first(['nickname', 'avatar']); + $data['name'] = $userInfo->nickname; $data['avatar'] = $userInfo->avatar; + $data['unread_num'] = $this->unreadTalkCache->get($user_id, $result['friend_id']); } else if ($result['type'] == 2) { - $groupInfo = Group::where('id', $result['group_id'])->first(['group_name', 'avatar']); + $groupInfo = Group::where('id', $result['group_id'])->first(['group_name', 'avatar']); + $data['name'] = $groupInfo->group_name; $data['avatar'] = $groupInfo->avatar; }