kuaifan преди 5 години
родител
ревизия
65d898a694
променени са 2 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 1 1
      app/Module/Base.php
  2. 7 7
      app/Services/WebSocketService.php

+ 1 - 1
app/Module/Base.php

@@ -795,7 +795,7 @@ class Base
                 unset($array[$k]);
             }
         }
-        return $array;
+        return array_values($array);
     }
 
     /**

+ 7 - 7
app/Services/WebSocketService.php

@@ -209,17 +209,17 @@ class WebSocketService implements WebSocketHandlerInterface
              * 收到信息回执
              */
             case 'roger':
-                if ($data['contentId'] > 0) {
+                $contentIds = Base::explodeInt(',', $data['contentId']);
+                if ($contentIds) {
                     $username = DB::table('ws')->where([
                         'fd' => $frame->fd,
                         'channel' => $data['channel'],
                     ])->value('username');
-                    DB::table('chat_msg')->where([
-                        'id' => $data['contentId'],
-                        'receive' => $username,
-                    ])->update([
-                        'roger' => 1,
-                    ]);
+                    if ($username) {
+                        DB::table('chat_msg')->where('receive', $username)->whereIn('id', $contentIds)->update([
+                            'roger' => 1,
+                        ]);
+                    }
                 }
                 break;