From e357429d3d38be74d84766c60943b3ce811548ce Mon Sep 17 00:00:00 2001 From: bob <312777916@qq.com> Date: Tue, 29 Apr 2025 23:19:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B6=88=E6=81=AF=E8=A6=81?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0=E6=9C=AC=E4=BA=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/event/index.js | 1 + src/js/event/receiveDeleteMsg.js | 10 ++++++++++ src/js/websocket/wsConnect.js | 4 +++- src/proto/msg.js | 31 +++++++++++++++++++------------ src/proto/msg.proto | 25 +++++++++++++------------ 5 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 src/js/event/receiveDeleteMsg.js diff --git a/src/js/event/index.js b/src/js/event/index.js index c762468..309501d 100644 --- a/src/js/event/index.js +++ b/src/js/event/index.js @@ -6,3 +6,4 @@ export * from './receiveGroupChatReadMsg' export * from './receiveGroupSystemMsg' export * from './receiveAtMsg' export * from './receiveRevokeMsg' +export * from './receiveDeleteMsg' diff --git a/src/js/event/receiveDeleteMsg.js b/src/js/event/receiveDeleteMsg.js new file mode 100644 index 0000000..2407a44 --- /dev/null +++ b/src/js/event/receiveDeleteMsg.js @@ -0,0 +1,10 @@ +import { useMessageStore } from '@/stores' + +export const onReceiveDeleteMsg = () => { + return (msg) => { + const messageData = useMessageStore() + const sessionId = msg.body.sessionId + const deleteMsgId = msg.body.content + messageData.removeMsgRecord(sessionId, deleteMsgId) + } +} diff --git a/src/js/websocket/wsConnect.js b/src/js/websocket/wsConnect.js index 6bff0f8..7d09f7b 100644 --- a/src/js/websocket/wsConnect.js +++ b/src/js/websocket/wsConnect.js @@ -21,7 +21,8 @@ import { onReceiveGroupChatReadMsg, onReceiveGroupSystemMsg, onReceiveAtMsg, - onReceiveRevokeMsg + onReceiveRevokeMsg, + onReceiveDeleteMsg } from '@/js/event' class WsConnect { @@ -123,6 +124,7 @@ class WsConnect { [MsgType.GROUP_CHAT_READ]: onReceiveGroupChatReadMsg(), [MsgType.AT]: onReceiveAtMsg(), [MsgType.REVOKE]: onReceiveRevokeMsg(), + [MsgType.DELETE]: onReceiveDeleteMsg(), [MsgType.SYS_GROUP_CREATE]: onReceiveGroupSystemMsg(), [MsgType.SYS_GROUP_ADD_MEMBER]: onReceiveGroupSystemMsg(), [MsgType.SYS_GROUP_DEL_MEMBER]: onReceiveGroupSystemMsg(), diff --git a/src/proto/msg.js b/src/proto/msg.js index e7391d9..a1261ff 100644 --- a/src/proto/msg.js +++ b/src/proto/msg.js @@ -295,6 +295,7 @@ export const Msg = ($root.Msg = (() => { * @property {number} STATUS_SYNC=10 STATUS_SYNC value * @property {number} AT=11 AT value * @property {number} REVOKE=12 REVOKE value + * @property {number} DELETE=13 DELETE value * @property {number} SYS_GROUP_CREATE=21 SYS_GROUP_CREATE value * @property {number} SYS_GROUP_ADD_MEMBER=22 SYS_GROUP_ADD_MEMBER value * @property {number} SYS_GROUP_DEL_MEMBER=23 SYS_GROUP_DEL_MEMBER value @@ -333,6 +334,7 @@ export const MsgType = ($root.MsgType = (() => { values[(valuesById[10] = 'STATUS_SYNC')] = 10 values[(valuesById[11] = 'AT')] = 11 values[(valuesById[12] = 'REVOKE')] = 12 + values[(valuesById[13] = 'DELETE')] = 13 values[(valuesById[21] = 'SYS_GROUP_CREATE')] = 21 values[(valuesById[22] = 'SYS_GROUP_ADD_MEMBER')] = 22 values[(valuesById[23] = 'SYS_GROUP_DEL_MEMBER')] = 23 @@ -549,6 +551,7 @@ export const Header = ($root.Header = (() => { case 10: case 11: case 12: + case 13: case 21: case 22: case 23: @@ -649,6 +652,10 @@ export const Header = ($root.Header = (() => { case 12: message.msgType = 12 break + case 'DELETE': + case 13: + message.msgType = 13 + break case 'SYS_GROUP_CREATE': case 21: message.msgType = 21 @@ -832,18 +839,18 @@ export const Body = ($root.Body = (() => { * | 8 | seq | - | - | M | M | M | M | O | O | M | todo | todo | * | 9 | sessionId | - | - | M | M | M | M | M | M | M | todo | todo | * +---+--------------+------+-----------+---------|-----------+---------------+-----------------+----------+----------------+----------+-------------------+---------------------+ - * NO filed STATUS_REQ STATUS_RES STATUS_SYNC SYS_GROUP_XXX AT(up) AT(down) REVOKE - * +---+--------------+------------+------------+-------------+------------+---------+---------+-----------+ - * | 1 | fromId | M | M | M | - | M | M | M | - * | 2 | fromClient | M | M | M | - | M | M | - | - * | 3 | toId | - | - | - | - | - | M | o | - * | 4 | toClient | - | - | - | - | - | M | - | - * | 5 | groupId | - | - | - | M | M | M | o | - * | 6 | msgId | - | - | - | M | - | M | M | - * | 7 | content | M | M | M | M | M | M | M | - * | 8 | seq | - | - | - | - | M | M | - | - * | 9 | sessionId | - | - | - | M | M | M | M | - * +---+--------------+------------+------------+-------------+------------+---------+---------+-----------+ + * NO filed STATUS_REQ STATUS_RES STATUS_SYNC SYS_GROUP_XXX AT(up) AT(down) REVOKE DELETE + * +---+--------------+------------+------------+-------------+------------+---------+---------+-----------+-----------+ + * | 1 | fromId | M | M | M | - | M | M | M | M | + * | 2 | fromClient | M | M | M | - | M | M | - | - | + * | 3 | toId | - | - | - | - | - | M | o | M | + * | 4 | toClient | - | - | - | - | - | M | - | M | + * | 5 | groupId | - | - | - | M | M | M | o | - | + * | 6 | msgId | - | - | - | M | - | M | M | M | + * | 7 | content | M | M | M | M | M | M | M | - | + * | 8 | seq | - | - | - | - | M | M | - | - | + * | 9 | sessionId | - | - | - | M | M | M | M | M | + * +---+--------------+------------+------------+-------------+------------+---------+---------+-----------+-----------+ * @implements IBody * @constructor * @param {IBody=} [properties] Properties to set diff --git a/src/proto/msg.proto b/src/proto/msg.proto index 6ad3d1a..151d8a7 100644 --- a/src/proto/msg.proto +++ b/src/proto/msg.proto @@ -20,6 +20,7 @@ enum MsgType { STATUS_SYNC = 10; //端侧的连接状态同步给云端(比如在线,离开) AT = 11; //@消息 REVOKE = 12; //撤回消息 + DELETE = 13; //删除消息 SYS_GROUP_CREATE = 21; //系统消息之创建群组 SYS_GROUP_ADD_MEMBER = 22; //系统消息之添加群组成员 @@ -67,18 +68,18 @@ message Header { | 8 | seq | - | - | M | M | M | M | O | O | M | todo | todo | | 9 | sessionId | - | - | M | M | M | M | M | M | M | todo | todo | +---+--------------+------+-----------+---------|-----------+---------------+-----------------+----------+----------------+----------+-------------------+---------------------+ - NO filed STATUS_REQ STATUS_RES STATUS_SYNC SYS_GROUP_XXX AT(up) AT(down) REVOKE -+---+--------------+------------+------------+-------------+------------+---------+---------+-----------+ -| 1 | fromId | M | M | M | - | M | M | M | -| 2 | fromClient | M | M | M | - | M | M | - | -| 3 | toId | - | - | - | - | - | M | o | -| 4 | toClient | - | - | - | - | - | M | - | -| 5 | groupId | - | - | - | M | M | M | o | -| 6 | msgId | - | - | - | M | - | M | M | -| 7 | content | M | M | M | M | M | M | M | -| 8 | seq | - | - | - | - | M | M | - | -| 9 | sessionId | - | - | - | M | M | M | M | -+---+--------------+------------+------------+-------------+------------+---------+---------+-----------+ + NO filed STATUS_REQ STATUS_RES STATUS_SYNC SYS_GROUP_XXX AT(up) AT(down) REVOKE DELETE ++---+--------------+------------+------------+-------------+------------+---------+---------+-----------+-----------+ +| 1 | fromId | M | M | M | - | M | M | M | M | +| 2 | fromClient | M | M | M | - | M | M | - | - | +| 3 | toId | - | - | - | - | - | M | o | M | +| 4 | toClient | - | - | - | - | - | M | - | M | +| 5 | groupId | - | - | - | M | M | M | o | - | +| 6 | msgId | - | - | - | M | - | M | M | M | +| 7 | content | M | M | M | M | M | M | M | - | +| 8 | seq | - | - | - | - | M | M | - | - | +| 9 | sessionId | - | - | - | M | M | M | M | M | ++---+--------------+------------+------------+-------------+------------+---------+---------+-----------+-----------+ */ message Body { optional string fromId = 1;