@aochuang/client-sdk 1.0.278 → 1.0.280

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.280",
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
- wechatAccountId: params.wechatAccountId
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,8 @@ export default class Websocket {
26
26
  onCmdChatroomMemberInfoChanged: null,
27
27
  onCmdChatroomInvite: null,
28
28
  onCmdNewGreetingMsg: null,
29
+ onCmdNewFriendRequest: null,
30
+ onCmdFriendAccepted: null,
29
31
  onHeartbeatCheck: null,
30
32
  onHeartbeatSuccess: null,
31
33
  onSendMessage: null,
@@ -104,6 +106,16 @@ export default class Websocket {
104
106
  options.onCmdNewGreetingMsg(evt)
105
107
  }
106
108
  })
109
+ this.socket.event.on('onCmdNewFriendRequest', (evt) => {
110
+ if (!options.checkSocketEventNotifyMethod || options.checkSocketEventNotifyMethod(evt) !== false) {
111
+ options.onCmdNewFriendRequest(evt)
112
+ }
113
+ })
114
+ this.socket.event.on('onCmdFriendAccepted', (evt) => {
115
+ if (!options.checkSocketEventNotifyMethod || options.checkSocketEventNotifyMethod(evt) !== false) {
116
+ options.onCmdFriendAccepted(evt)
117
+ }
118
+ })
107
119
  this.socket.event.on('onCmdMessageRecalled', options.onCmdMessageRecalled)
108
120
  this.socket.event.on('onHeartbeatCheck', ({ mergeParams }) => {
109
121
  options.onHeartbeatCheck && options.onHeartbeatCheck({
@@ -931,7 +931,7 @@ class ClientChat {
931
931
  }
932
932
  },
933
933
  // 打招呼有变化
934
- onCmdNewGreetingMsg: ({ data }) => {
934
+ onCmdNewGreetingMsg: ({ data }) => {
935
935
  // {
936
936
  // "cmdType": "CmdNewGreetingMsg",
937
937
  // "seq": 440013669,
@@ -944,6 +944,26 @@ class ClientChat {
944
944
  unreadGreetingMsgCount: data.unreadGreetingMsgCount
945
945
  })
946
946
  },
947
+ onCmdNewFriendRequest: ({ data }) => {
948
+ // 刷新指定微信号请求数量
949
+ if (data.wechatAccountId) {
950
+ this.account.getAccountGreetingUnreadMsgCount({
951
+ wechatAccountId: data.wechatAccountId
952
+ })
953
+ }
954
+ // 刷新所有微信号请求数量
955
+ this.account.getAccountGreetingUnreadMsgCount()
956
+ },
957
+ onCmdFriendAccepted: ({ data }) => {
958
+ // 刷新指定微信号请求数量
959
+ if (data.wechatAccountId) {
960
+ this.account.getAccountGreetingUnreadMsgCount({
961
+ wechatAccountId: data.wechatAccountId
962
+ })
963
+ }
964
+ // 刷新所有微信号请求数量
965
+ this.account.getAccountGreetingUnreadMsgCount()
966
+ },
947
967
  onHeartbeatCheck: ({ mergeParams }) => {
948
968
  const ids = this.account.getAccountData().map(v => v.id)
949
969
  mergeParams({