@aochuang/client-sdk 1.0.278 → 1.0.279

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.278",
3
+ "version": "1.0.279",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -384,16 +384,13 @@ export default class ClientChatAccount {
384
384
  * 获取打招呼未读消息总数
385
385
  */
386
386
  getAccountGreetingUnreadMsgCount (params) {
387
- if (!params || !params.wechatAccountId) {
388
- throw new Error('缺少必须参数')
389
- }
390
387
  if (!this.getAccountGreetingUnreadMsgCountMethod) {
391
388
  return new Error('getAccountGreetingUnreadMsgCountMethod未定义')
392
389
  }
393
390
  return this.getAccountGreetingUnreadMsgCountMethod({
394
391
  wechatAccountId: params.wechatAccountId
395
392
  }).then(rs => {
396
- Vue.set(this.accountGreetingUnreadMsgCountData, params.wechatAccountId, (rs || {}).data || 0)
393
+ Vue.set(this.accountGreetingUnreadMsgCountData, params.wechatAccountId || 'all', (rs || {}).data || 0)
397
394
  })
398
395
  }
399
396
 
@@ -26,6 +26,7 @@ export default class Websocket {
26
26
  onCmdChatroomMemberInfoChanged: null,
27
27
  onCmdChatroomInvite: null,
28
28
  onCmdNewGreetingMsg: null,
29
+ onCmdNewFriendRequest: null,
29
30
  onHeartbeatCheck: null,
30
31
  onHeartbeatSuccess: null,
31
32
  onSendMessage: null,
@@ -104,6 +105,11 @@ export default class Websocket {
104
105
  options.onCmdNewGreetingMsg(evt)
105
106
  }
106
107
  })
108
+ this.socket.event.on('onCmdNewFriendRequest', (evt) => {
109
+ if (!options.checkSocketEventNotifyMethod || options.checkSocketEventNotifyMethod(evt) !== false) {
110
+ options.onCmdNewFriendRequest(evt)
111
+ }
112
+ })
107
113
  this.socket.event.on('onCmdMessageRecalled', options.onCmdMessageRecalled)
108
114
  this.socket.event.on('onHeartbeatCheck', ({ mergeParams }) => {
109
115
  options.onHeartbeatCheck && options.onHeartbeatCheck({
@@ -944,6 +944,12 @@ class ClientChat {
944
944
  unreadGreetingMsgCount: data.unreadGreetingMsgCount
945
945
  })
946
946
  },
947
+ onCmdNewFriendRequest: ({ data }) => {
948
+ // 刷新未读
949
+ this.account.getAccountGreetingUnreadMsgCount({
950
+ wechatAccountId: data.wechatAccountId
951
+ })
952
+ },
947
953
  onHeartbeatCheck: ({ mergeParams }) => {
948
954
  const ids = this.account.getAccountData().map(v => v.id)
949
955
  mergeParams({