AI 3 months ago
parent
commit
8065173ef2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      app/JsonRpc/ChatService.php

+ 2 - 0
app/JsonRpc/ChatService.php

@@ -313,6 +313,7 @@ class ChatService implements ChatServiceInterface
         $userId = $data['user_id'];
         $unreadMessages = ChatRecords::where('user_id', $userId)
             ->where('is_read', 0)
+            ->where('action', 'recieved')
             ->leftJoin('user', 'chat_records.receiver_id', '=', 'user.id')
             ->leftJoin('chat_groups', 'chat_records.receiver_id', '=', 'chat_groups.id')
             ->select(
@@ -331,6 +332,7 @@ class ChatService implements ChatServiceInterface
         // 查询已读消息,并将 num 字段设置为 0
         $readMessages = ChatRecords::where('user_id', $userId)
             ->where('is_read', 1)
+            ->where('action', 'recieved')
             ->leftJoin('user', 'chat_records.receiver_id', '=', 'user.id')
             ->leftJoin('chat_groups', 'chat_records.receiver_id', '=', 'chat_groups.id')
             ->select(