增加后台消息通知管理

This commit is contained in:
mzl
2025-08-21 15:47:05 +08:00
parent 58dc6729d9
commit c1de258ce2
8 changed files with 197 additions and 18 deletions
+7 -6
View File
@@ -146,9 +146,9 @@ class WsEvents
if (!$title || !$content) {
Gateway::sendToClient($this->clientId, WsResponse::error(
'notify.push',
'notify.push.result',
400,
'title and content are required',
'标题和内容不能为空',
$traceId
));
return;
@@ -163,13 +163,14 @@ class WsEvents
'content' => $content,
'scene' => $this->eventData['scene'] ?? 0,
'recipient' => $this->eventData['to_uids'] ? implode(',', $this->eventData['to_uids']) : '',
'push_method' => isset($this->eventData['push_method']) ? $this->eventData['push_method'] : 0
]);
// 写用户状态
$uids = !empty($toUids) ? $toUids : $msgService->getAllUserIds();
$msgService->addUserStatus($msgId, $uids);
$payload = WsResponse::success('notify.push', [
$payload = WsResponse::success('notify.receive', [
'msg_id' => $msgId,
'title' => $title,
'content' => $content,
@@ -203,9 +204,9 @@ class WsEvents
$msgIds = $this->eventData['msg_ids'];
if (!is_array($msgIds) && $msgIds !== 'all') {
Gateway::sendToClient($this->clientId, WsResponse::error(
'notify.read',
'notify.read.result',
400,
'msg_ids required',
'消息ID不能为空',
$traceId
));
return;
@@ -227,7 +228,7 @@ class WsEvents
*/
public function pushNotice(int $msgId, string $title, string $content, array $recipient)
{
$payload = WsResponse::success('notify.push', [
$payload = WsResponse::success('notify.receive', [
'msg_id' => $msgId,
'title' => $title,
'content' => $content,