@aochuang/client-sdk 1.0.402 → 1.0.404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -130,9 +130,10 @@ export default {
|
|
|
130
130
|
return this.nextContent.content || ''
|
|
131
131
|
},
|
|
132
132
|
voiceContent () {
|
|
133
|
+
// voice.vue 只读取 resPath 作为音频地址、voiceDuration(秒)作为时长
|
|
133
134
|
return {
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
resPath: this.src,
|
|
136
|
+
voiceDuration: this.duration
|
|
136
137
|
}
|
|
137
138
|
},
|
|
138
139
|
addonEditControl () {
|
package/package.json
CHANGED
|
@@ -1048,17 +1048,18 @@ export default class ClientChatSession {
|
|
|
1048
1048
|
if (typeof dto.unreadMsgCount !== 'number') {
|
|
1049
1049
|
throw new Error('标记未读返回的未读数无效')
|
|
1050
1050
|
}
|
|
1051
|
+
const beforeUnreadMsgCount = session.unreadMsgCount || 0
|
|
1051
1052
|
const localLastMsgTime = session.lastMsgTime || 0
|
|
1052
1053
|
const serverLastMsgTime = dto.lastMsgTime || 0
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1054
|
+
const isSameLastMessage = Boolean(
|
|
1055
|
+
session.lastMsgId && dto.lastMsgId && session.lastMsgId === dto.lastMsgId
|
|
1056
|
+
)
|
|
1057
|
+
const shouldApplyLastMessage = isSameLastMessage || serverLastMsgTime >= localLastMsgTime
|
|
1058
|
+
const afterUnreadMsgCount = shouldApplyLastMessage
|
|
1059
|
+
? dto.unreadMsgCount
|
|
1060
|
+
: Math.max(beforeUnreadMsgCount, dto.unreadMsgCount)
|
|
1060
1061
|
const patch = {
|
|
1061
|
-
unreadMsgCount:
|
|
1062
|
+
unreadMsgCount: afterUnreadMsgCount
|
|
1062
1063
|
}
|
|
1063
1064
|
const lastMessageFields = [
|
|
1064
1065
|
'lastMsgId',
|
|
@@ -1067,22 +1068,24 @@ export default class ClientChatSession {
|
|
|
1067
1068
|
'lastMsgContent',
|
|
1068
1069
|
'senderWechatIdHash'
|
|
1069
1070
|
]
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1071
|
+
if (shouldApplyLastMessage) {
|
|
1072
|
+
lastMessageFields.forEach(field => {
|
|
1073
|
+
if (typeof dto[field] !== 'undefined' && dto[field] !== null) {
|
|
1074
|
+
patch[field] = dto[field]
|
|
1075
|
+
}
|
|
1076
|
+
})
|
|
1077
|
+
}
|
|
1075
1078
|
this.updateSession(sessionId, patch)
|
|
1076
1079
|
const unreadChangeResult = this.onSessionUnreadChange && this.onSessionUnreadChange({
|
|
1077
1080
|
session,
|
|
1078
1081
|
beforeUnreadMsgCount,
|
|
1079
|
-
afterUnreadMsgCount
|
|
1082
|
+
afterUnreadMsgCount
|
|
1080
1083
|
})
|
|
1081
1084
|
const result = {
|
|
1082
1085
|
applied: true,
|
|
1083
1086
|
session,
|
|
1084
1087
|
beforeUnreadMsgCount,
|
|
1085
|
-
afterUnreadMsgCount
|
|
1088
|
+
afterUnreadMsgCount
|
|
1086
1089
|
}
|
|
1087
1090
|
if (unreadChangeResult && typeof unreadChangeResult.then === 'function') {
|
|
1088
1091
|
return unreadChangeResult.then(() => result)
|