|
@@ -182,8 +182,32 @@ class ChatService implements ChatServiceInterface
|
|
|
'status' => $status,
|
|
|
]
|
|
|
);
|
|
|
- Db::commit();
|
|
|
|
|
|
+ // 给对方发送通知
|
|
|
+ $friendId = $fr['user_id'];
|
|
|
+ $userId = $fr['friend_id'];
|
|
|
+ $content = "你们已经成为好友了" . date("Y-m-d H:i:s");
|
|
|
+ $chatRecordsData = [[
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'receiver_id' => $friendId,
|
|
|
+ 'content' => $content,
|
|
|
+ 'msg_type' => 1,
|
|
|
+ 'is_read' => 1,
|
|
|
+ 'talk_type' => 1,
|
|
|
+ 'action' => 'said',
|
|
|
+
|
|
|
+ ], [
|
|
|
+ 'user_id' => $friendId,
|
|
|
+ 'receiver_id' => $userId,
|
|
|
+ 'content' => $content,
|
|
|
+ 'msg_type' => 1,
|
|
|
+ 'is_read' => 1,
|
|
|
+ 'talk_type' => 1,
|
|
|
+ 'action' => 'recieved',
|
|
|
+
|
|
|
+ ]];
|
|
|
+ ChatRecords::insert($chatRecordsData);
|
|
|
+ Db::commit();
|
|
|
} catch (\Throwable $ex) {
|
|
|
Db::rollBack();
|
|
|
var_dump($ex->getMessage());
|