xiaogang 4 years ago
parent
commit
58c0834d25
1 changed files with 5 additions and 0 deletions
  1. 5 0
      app/Http/Controllers/Api/ChatController.php

+ 5 - 0
app/Http/Controllers/Api/ChatController.php

xqd
@@ -45,6 +45,11 @@ class ChatController extends Controller
                 'to_user_id'=>$toUser->id,
                 'atime'=>date('Y-m-d H:i:s'),
             ]);
+            ChatList::query()->firstOrCreate([
+                'user_id'=>$toUser->id,
+                'to_user_id'=>$user->id,
+                'atime'=>date('Y-m-d H:i:s'),
+            ]);
             DB::commit();
         }catch (\Exception $exception){
             DB::rollBack();