perf: 会话消息没有接收人时已读进度优化

This commit is contained in:
kuaifan 2023-07-29 15:43:48 +08:00
parent 829ed0a575
commit 9ea1fa6df7

View File

@ -157,6 +157,21 @@ class WebSocketDialogMsgTask extends AbstractTask
// 更新已发送数量 // 更新已发送数量
$msg->send = WebSocketDialogMsgRead::whereMsgId($msg->id)->count(); $msg->send = WebSocketDialogMsgRead::whereMsgId($msg->id)->count();
$msg->save(); $msg->save();
// 没有接收人时通知发送人已读
if ($msg->send === 0) {
PushTask::push([
'userid' => $msg->userid,
'msg' => [
'type' => 'dialog',
'mode' => 'readed',
'data' => [
'id' => $msg->id,
'read' => $msg->read,
'percentage' => $msg->percentage,
],
]
]);
}
// 开始推送消息 // 开始推送消息
$umengUserid = []; $umengUserid = [];
foreach ($array as $item) { foreach ($array as $item) {