删除消息要同步到本人其他账号

This commit is contained in:
bob
2025-04-29 23:19:20 +08:00
parent 240b0560dc
commit e357429d3d
5 changed files with 46 additions and 25 deletions

View File

@@ -6,3 +6,4 @@ export * from './receiveGroupChatReadMsg'
export * from './receiveGroupSystemMsg'
export * from './receiveAtMsg'
export * from './receiveRevokeMsg'
export * from './receiveDeleteMsg'

View File

@@ -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)
}
}

View File

@@ -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(),

View File

@@ -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

View File

@@ -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;