linkdood-web-sdk 0.1.0 → 1.0.2

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.
Files changed (87) hide show
  1. package/lib/cache/ChatCache.js +3 -3
  2. package/lib/cache/GroupCache.js +3 -3
  3. package/lib/cache/GroupMemberCache.js +6 -2
  4. package/lib/cache/GroupMessageCache.js +7 -3
  5. package/lib/cache/MessageCache.js +6 -2
  6. package/lib/cache/MessageTimeStampCache.js +2 -2
  7. package/lib/cache/MyselfCache.js +2 -2
  8. package/lib/cache/SystemDictionaryCache.js +3 -3
  9. package/lib/cache/SystemMessageCache.js +1 -1
  10. package/lib/cache/TimeStampCache.js +2 -2
  11. package/lib/cache/db/IMDB.js +1 -1
  12. package/lib/cache/db/bean/Buddy.js +3 -3
  13. package/lib/cache/db/bean/Chat.js +3 -3
  14. package/lib/cache/db/bean/GroupMessage.js +2 -2
  15. package/lib/cache/db/bean/Message.js +3 -3
  16. package/lib/cache/db/bean/SystemDictionarie.js +3 -3
  17. package/lib/cache/db/bean/SystemMessage.js +3 -3
  18. package/lib/cache/db/bean/Timestamp.js +3 -3
  19. package/lib/core/LinkdoodWebSDK.js +3 -3
  20. package/lib/core/action/ApplicationAction.js +2 -2
  21. package/lib/core/action/AuthAction.js +8 -8
  22. package/lib/core/action/BuddyAction.js +11 -11
  23. package/lib/core/action/ChatAction.js +2 -2
  24. package/lib/core/action/ConfigAction.js +5 -5
  25. package/lib/core/action/EnterpriseAction.js +2 -2
  26. package/lib/core/action/FeedBackAction.js +1 -1
  27. package/lib/core/action/FileAction.js +3 -3
  28. package/lib/core/action/GroupAction.js +6 -6
  29. package/lib/core/action/HelpAction.js +2 -2
  30. package/lib/core/action/MessageAction.js +6 -6
  31. package/lib/core/action/SearchAction.js +2 -2
  32. package/lib/core/action/SubscribeAction.js +2 -2
  33. package/lib/core/action/SystemAction.js +3 -3
  34. package/lib/core/action/SystemMessageAction.js +2 -2
  35. package/lib/core/action/UserAction.js +5 -5
  36. package/lib/core/action/index.js +1 -1
  37. package/lib/decorator/ErrorORCompletionDecorator.js +1 -1
  38. package/lib/error/JSDKError.js +2 -2
  39. package/lib/model/loginModel.js +1 -1
  40. package/lib/model/thriftConnectionModel.js +1 -1
  41. package/lib/model/userModel.js +1 -1
  42. package/lib/notify/NotifyHeartBeat.js +2 -3
  43. package/lib/notify/send/children/noticeReply.js +1 -1
  44. package/lib/notify/send/children/notifyGroupMemberInfoRefresh.js +2 -3
  45. package/lib/notify/send/children/notifyGroupRefresh.js +1 -1
  46. package/lib/notify/send/children/notifyOperateBuddy.js +1 -1
  47. package/lib/notify/send/children/notifyOperateUser.js +1 -1
  48. package/lib/notify/send/children/notifySendMessage.js +2 -2
  49. package/lib/notify/send/children/notifyTransferGroup.js +2 -2
  50. package/lib/offline/OfflineBuddy.js +1 -1
  51. package/lib/offline/OfflineEnterprise.js +1 -1
  52. package/lib/offline/OfflineGroup.js +2 -2
  53. package/lib/offline/OfflineHelp.js +1 -1
  54. package/lib/offline/OfflineMessage.js +4 -4
  55. package/lib/offline/OfflineMyself.js +1 -1
  56. package/lib/service/ApplicationService.js +5 -5
  57. package/lib/service/BuddyService.js +15 -15
  58. package/lib/service/ChatService.js +19 -19
  59. package/lib/service/CommonService.js +4 -4
  60. package/lib/service/EnterpriseService.js +9 -9
  61. package/lib/service/GroupMemberService.js +29 -24
  62. package/lib/service/GroupMessageService.js +5 -5
  63. package/lib/service/GroupService.js +9 -9
  64. package/lib/service/HelpService.js +4 -4
  65. package/lib/service/LoginService.js +6 -6
  66. package/lib/service/MessageService.js +20 -20
  67. package/lib/service/MessageTimeStampService.js +4 -4
  68. package/lib/service/MyselfService.js +4 -4
  69. package/lib/service/SubscribeService.js +3 -3
  70. package/lib/service/SystemDictionaryService.js +3 -3
  71. package/lib/service/SystemMessageService.js +2 -2
  72. package/lib/service/TimeStampService.js +4 -4
  73. package/lib/thrift/client/ThriftBase.js +1 -1
  74. package/lib/thrift/client/ThriftHoldClient.js +1 -1
  75. package/lib/thrift/client/ThriftNotifyClient.js +1 -1
  76. package/lib/thrift/client/ThriftServiceClient.js +1 -1
  77. package/lib/thrift/lib/thrift.js +2 -2
  78. package/lib/thrift/merge/thrift-merge.js +13 -2
  79. package/lib/thrift/thriftClient.js +3 -3
  80. package/lib/utils/_decorators.js +1 -1
  81. package/lib/utils/commonUtil.js +7 -2
  82. package/lib/utils/filesUtil.js +4 -4
  83. package/lib/utils/groupJudgeUtil.js +11 -10
  84. package/lib/utils/request.js +2 -2
  85. package/node_modules.rar +0 -0
  86. package/package.json +3 -4
  87. package/dist/linkdoodWebSDK.js +0 -13
@@ -2,4 +2,4 @@
2
2
  * 我的信息 离线处理
3
3
  * @author 李文龙
4
4
  * @date 2020/5/19
5
- */var _default=new(/*#__PURE__*/function(){function OfflineHelp(){(0,_classCallCheck2.default)(this,OfflineHelp)}(0,_createClass2.default)(OfflineHelp,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var cacheTimeStamp,serviceTimeStamp,help;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _SystemDictionaryService.default.getSystemDictionaryValueByKey(_dictionaryConstant.default.helpTimeStamp);case 2:cacheTimeStamp=_context.sent;_context.next=5;return _HelpService.default.getServiceTime();case 5:serviceTimeStamp=_context.sent;_context.next=8;return _HelpService.default.getHelp();case 8:help=_context.sent;if(!(help.length==0)){_context.next=15;break}_context.next=12;return _HelpService.default.queryAndUpdateHelp();case 12:_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.helpTimeStamp,serviceTimeStamp);_context.next=19;break;case 15:if(!(cacheTimeStamp!=serviceTimeStamp)){_context.next=19;break}_context.next=18;return _HelpService.default.queryAndUpdateHelp();case 18:_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.helpTimeStamp,serviceTimeStamp);case 19:case"end":return _context.stop();}},_callee)}));function run(){return _run.apply(this,arguments)}return run}()}]);return OfflineHelp}());exports.default=_default;
5
+ */var _default=new(/*#__PURE__*/function(){function OfflineHelp(){(0,_classCallCheck2.default)(this,OfflineHelp)}(0,_createClass2.default)(OfflineHelp,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var cacheTimeStamp,serviceTimeStamp,help;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _SystemDictionaryService.default.getSystemDictionaryValueByKey(_dictionaryConstant.default.helpTimeStamp);case 2:cacheTimeStamp=_context.sent;_context.next=5;return _HelpService.default.getServiceTime();case 5:serviceTimeStamp=_context.sent;_context.next=8;return _HelpService.default.getHelp();case 8:help=_context.sent;if(!(help.length==0)){_context.next=15;break}_context.next=12;return _HelpService.default.queryAndUpdateHelp();case 12:_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.helpTimeStamp,serviceTimeStamp);_context.next=19;break;case 15:if(!(cacheTimeStamp!=serviceTimeStamp)){_context.next=19;break}_context.next=18;return _HelpService.default.queryAndUpdateHelp();case 18:_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.helpTimeStamp,serviceTimeStamp);case 19:case"end":return _context.stop();}}},_callee)}));function run(){return _run.apply(this,arguments)}return run}()}]);return OfflineHelp}());exports.default=_default;
@@ -1,8 +1,8 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _GroupService=_interopRequireDefault(require("../service/GroupService"));var _MessageService=_interopRequireDefault(require("../service/MessageService"));var _MessageTimeStampService=_interopRequireDefault(require("../service/MessageTimeStampService"));/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _GroupService=_interopRequireDefault(require("../service/GroupService"));var _MessageService=_interopRequireDefault(require("../service/MessageService"));var _MessageTimeStampService=_interopRequireDefault(require("../service/MessageTimeStampService"));/**
2
2
  * 离线消息处理
3
3
  * @author 李文龙
4
4
  * @date 2020/1/16
5
- */var _default=new(/*#__PURE__*/function(){function OfflineMessage(){(0,_classCallCheck2.default)(this,OfflineMessage)}(0,_createClass2.default)(OfflineMessage,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var groupList,groupIds,messageAllRes,i,item,targetID,minMessageID,maxUnreadID,messageTimeStamp;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _GroupService.default.getGroupList();case 2:_context.t0=_context.sent;if(_context.t0){_context.next=5;break}_context.t0=[];case 5:groupList=_context.t0;groupIds=groupList.map(function(item){return item.groupID});_context.next=9;return(0,_thriftClient.serviceClient)("getAllMessageCursors2",true,groupIds);case 9:messageAllRes=_context.sent;if(!(messageAllRes.code==0&&messageAllRes.cursors)){_context.next=23;break}i=0;case 12:if(!(i<messageAllRes.cursors.length)){_context.next=23;break}item=messageAllRes.cursors[i],targetID=item.targetID,minMessageID=item.minMessageID,maxUnreadID=item.maxUnreadID;_context.next=16;return _MessageTimeStampService.default.getMessageTimeStampByChatID(targetID);case 16:messageTimeStamp=_context.sent;if(!(!messageTimeStamp||messageTimeStamp.messageID<maxUnreadID)){_context.next=20;break}_context.next=20;return this.obtainMessage(targetID,messageTimeStamp&&messageTimeStamp.messageID||minMessageID);case 20:i++;_context.next=12;break;case 23:case"end":return _context.stop();}},_callee,this)}));function run(){return _run.apply(this,arguments)}return run}()/**
5
+ */var _default=new(/*#__PURE__*/function(){function OfflineMessage(){(0,_classCallCheck2.default)(this,OfflineMessage)}(0,_createClass2.default)(OfflineMessage,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var groupList,groupIds,messageAllRes,i,item,targetID,minMessageID,maxUnreadID,messageTimeStamp;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _GroupService.default.getGroupList();case 2:_context.t0=_context.sent;if(_context.t0){_context.next=5;break}_context.t0=[];case 5:groupList=_context.t0;groupIds=groupList.map(function(item){return item.groupID});_context.next=9;return(0,_thriftClient.serviceClient)("getAllMessageCursors2",true,groupIds);case 9:messageAllRes=_context.sent;if(!(messageAllRes.code==0&&messageAllRes.cursors)){_context.next=23;break}i=0;case 12:if(!(i<messageAllRes.cursors.length)){_context.next=23;break}item=messageAllRes.cursors[i],targetID=item.targetID,minMessageID=item.minMessageID,maxUnreadID=item.maxUnreadID;_context.next=16;return _MessageTimeStampService.default.getMessageTimeStampByChatID(targetID);case 16:messageTimeStamp=_context.sent;if(!(!messageTimeStamp||messageTimeStamp.messageID<maxUnreadID)){_context.next=20;break}_context.next=20;return this.obtainMessage(targetID,messageTimeStamp&&messageTimeStamp.messageID||minMessageID);case 20:i++;_context.next=12;break;case 23:case"end":return _context.stop();}}},_callee,this)}));function run(){return _run.apply(this,arguments)}return run}()/**
6
6
  * 拉取离线消息&入库
7
- */},{key:"obtainMessage",value:function(){var _obtainMessage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(targetID,messageID){var messages,i,message;return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return(0,_thriftClient.serviceClient)("getMessages",true,targetID,messageID,-128);case 2:messages=_context2.sent;if(!(messages.code==0&&messages.msgs&&messages.msgs.messageList.length>0)){_context2.next=17;break}_context2.next=6;return _MessageTimeStampService.default.addReceiveMessageTimeStampCache((0,_toConsumableArray2.default)(messages.msgs.messageList).pop());case 6:i=0;case 7:if(!(i<messages.msgs.messageList.length)){_context2.next=17;break}message=messages.msgs.messageList[i];//console.log( message.messageType, message.setRead);
8
- if(!message){_context2.next=14;break}_context2.next=12;return _MessageService.default.packageLocalMessageStoreBean(message,1);case 12:_context2.next=14;return _MessageService.default.addReceiveMessageCache(message);case 14:i++;_context2.next=7;break;case 17:case"end":return _context2.stop();}},_callee2)}));function obtainMessage(_x,_x2){return _obtainMessage.apply(this,arguments)}return obtainMessage}()}]);return OfflineMessage}());exports.default=_default;
7
+ */},{key:"obtainMessage",value:function(){var _obtainMessage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(targetID,messageID){var messages,i,message;return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return(0,_thriftClient.serviceClient)("getMessages",true,targetID,messageID,-128);case 2:messages=_context2.sent;if(!(messages.code==0&&messages.msgs&&messages.msgs.messageList.length>0)){_context2.next=17;break}_context2.next=6;return _MessageTimeStampService.default.addReceiveMessageTimeStampCache((0,_toConsumableArray2.default)(messages.msgs.messageList).pop());case 6:i=0;case 7:if(!(i<messages.msgs.messageList.length)){_context2.next=17;break}message=messages.msgs.messageList[i];//console.log( message.messageType, message.setRead);
8
+ if(!message){_context2.next=14;break}_context2.next=12;return _MessageService.default.packageLocalMessageStoreBean(message,1);case 12:_context2.next=14;return _MessageService.default.addReceiveMessageCache(message);case 14:i++;_context2.next=7;break;case 17:case"end":return _context2.stop();}}},_callee2)}));function obtainMessage(_x,_x2){return _obtainMessage.apply(this,arguments)}return obtainMessage}()}]);return OfflineMessage}());exports.default=_default;
@@ -2,4 +2,4 @@
2
2
  * 我的信息 离线处理
3
3
  * @author 李文龙
4
4
  * @date 2020/5/19
5
- */var _default=new(/*#__PURE__*/function(){function OfflineMyself(){(0,_classCallCheck2.default)(this,OfflineMyself)}(0,_createClass2.default)(OfflineMyself,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var info,myself;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return _TimeStampService.default.getTimeStampInfo("myselfID");case 2:info=_context.sent;_context.next=5;return _MyselfService.default.getMyselfCache();case 5:myself=_context.sent;if(myself){_context.next=15;break}_context.next=9;return(0,_thriftClient.serviceClient)("getMyself",true);case 9:myself=_context.sent;_context.next=12;return _MyselfService.default.addMyself(myself.ub);case 12:_TimeStampService.default.updateTimeStamp("myselfID",info.item);_context.next=22;break;case 15:if(!(info&&info.isUpdate)){_context.next=22;break}_context.next=18;return(0,_thriftClient.serviceClient)("getMyself",true);case 18:myself=_context.sent;_context.next=21;return _MyselfService.default.updateMyself(myself.ub);case 21:_TimeStampService.default.updateTimeStamp("myselfID",info.item);case 22:case"end":return _context.stop();}},_callee)}));function run(){return _run.apply(this,arguments)}return run}()}]);return OfflineMyself}());exports.default=_default;
5
+ */var _default=new(/*#__PURE__*/function(){function OfflineMyself(){(0,_classCallCheck2.default)(this,OfflineMyself)}(0,_createClass2.default)(OfflineMyself,[{key:"run",value:function(){var _run=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var info,myself;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _TimeStampService.default.getTimeStampInfo("myselfID");case 2:info=_context.sent;_context.next=5;return _MyselfService.default.getMyselfCache();case 5:myself=_context.sent;if(myself){_context.next=15;break}_context.next=9;return(0,_thriftClient.serviceClient)("getMyself",true);case 9:myself=_context.sent;_context.next=12;return _MyselfService.default.addMyself(myself.ub);case 12:_TimeStampService.default.updateTimeStamp("myselfID",info.item);_context.next=22;break;case 15:if(!(info&&info.isUpdate)){_context.next=22;break}_context.next=18;return(0,_thriftClient.serviceClient)("getMyself",true);case 18:myself=_context.sent;_context.next=21;return _MyselfService.default.updateMyself(myself.ub);case 21:_TimeStampService.default.updateTimeStamp("myselfID",info.item);case 22:case"end":return _context.stop();}}},_callee)}));function run(){return _run.apply(this,arguments)}return run}()}]);return OfflineMyself}());exports.default=_default;
@@ -1,14 +1,14 @@
1
1
  "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _userModel=_interopRequireDefault(require("../model/userModel"));var _thriftClient=require("../thrift/thriftClient");/**
2
2
  * 应用-业务
3
- */var _default=new(/*#__PURE__*/function(){function ApplicationService(){(0,_classCallCheck2.default)(this,ApplicationService)}(0,_createClass2.default)(ApplicationService,[{key:"getAllApplication",value:/**
3
+ */var _default=new(/*#__PURE__*/function(){function ApplicationService(){(0,_classCallCheck2.default)(this,ApplicationService)}(0,_createClass2.default)(ApplicationService,[{key:"getAllApplication",/**
4
4
  * 获取所有应用信息
5
5
  * @returns {Promise<null|[]>}
6
- */function(){var _getAllApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var pltFParam,smallMarketAppQueryParam,res;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:pltFParam=new PltFParam;pltFParam.type=1;smallMarketAppQueryParam=new SmallMarketAppQueryParam;smallMarketAppQueryParam.pageNum=1;smallMarketAppQueryParam.pageSize=128;smallMarketAppQueryParam.deviceType=1;smallMarketAppQueryParam.userID=Number(_userModel.default.userID);pltFParam.query=smallMarketAppQueryParam;_context.next=10;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 10:res=_context.sent;return _context.abrupt("return",res.page.marketAppInfos||[]);case 12:case"end":return _context.stop();}},_callee)}));function getAllApplication(){return _getAllApplication.apply(this,arguments)}return getAllApplication}()/**
6
+ */value:function(){var _getAllApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var pltFParam,smallMarketAppQueryParam,res;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:pltFParam=new PltFParam;pltFParam.type=1;smallMarketAppQueryParam=new SmallMarketAppQueryParam;smallMarketAppQueryParam.pageNum=1;smallMarketAppQueryParam.pageSize=128;smallMarketAppQueryParam.deviceType=1;smallMarketAppQueryParam.userID=_userModel.default.userID;pltFParam.query=smallMarketAppQueryParam;_context.next=10;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 10:res=_context.sent;return _context.abrupt("return",res.page.marketAppInfos||[]);case 12:case"end":return _context.stop();}}},_callee)}));function getAllApplication(){return _getAllApplication.apply(this,arguments)}return getAllApplication}()/**
7
7
  * 获取已安装应用
8
8
  * @returns {Promise<null|[]>}
9
- */},{key:"getInstallApplication",value:function(){var _getInstallApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(){var pltFParam,res;return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:pltFParam=new PltFParam;pltFParam.type=3;pltFParam.value32_1=2;_context2.next=5;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 5:res=_context2.sent;return _context2.abrupt("return",res.listSMAppInfo||[]);case 7:case"end":return _context2.stop();}},_callee2)}));function getInstallApplication(){return _getInstallApplication.apply(this,arguments)}return getInstallApplication}()/**
9
+ */},{key:"getInstallApplication",value:function(){var _getInstallApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(){var pltFParam,res;return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:pltFParam=new PltFParam;pltFParam.type=3;pltFParam.value32_1=2;_context2.next=5;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 5:res=_context2.sent;return _context2.abrupt("return",res.listSMAppInfo||[]);case 7:case"end":return _context2.stop();}}},_callee2)}));function getInstallApplication(){return _getInstallApplication.apply(this,arguments)}return getInstallApplication}()/**
10
10
  * 获取推荐页面应用列表
11
11
  * (包含-除默认安装外的所有应用信息)
12
- */},{key:"getRecommendApplication",value:function(){var _getRecommendApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(){var allApp,instAppIds,recommendApp;return _regenerator.default.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return this.getAllApplication();case 2:allApp=_context3.sent;_context3.next=5;return this.getInstallApplication();case 5:instAppIds=_context3.sent.map(function(item){return item.appID});recommendApp=[];allApp.forEach(function(app){//排除默认安装
12
+ */},{key:"getRecommendApplication",value:function(){var _getRecommendApplication=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(){var allApp,instAppIds,recommendApp;return _regenerator.default.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return this.getAllApplication();case 2:allApp=_context3.sent;_context3.next=5;return this.getInstallApplication();case 5:instAppIds=_context3.sent.map(function(item){return item.appID});recommendApp=[];allApp.forEach(function(app){//排除默认安装
13
13
  if(app.defaultInstall!=1){//判断是否已安装
14
- if(instAppIds.includes(app.appID)){app.isInstall=1}else{app.isInstall=0}recommendApp.push(app)}});return _context3.abrupt("return",recommendApp);case 9:case"end":return _context3.stop();}},_callee3,this)}));function getRecommendApplication(){return _getRecommendApplication.apply(this,arguments)}return getRecommendApplication}()}]);return ApplicationService}());exports.default=_default;
14
+ if(instAppIds.includes(app.appID)){app.isInstall=1}else{app.isInstall=0}recommendApp.push(app)}});return _context3.abrupt("return",recommendApp);case 9:case"end":return _context3.stop();}}},_callee3,this)}));function getRecommendApplication(){return _getRecommendApplication.apply(this,arguments)}return getRecommendApplication}()}]);return ApplicationService}());exports.default=_default;
@@ -1,22 +1,22 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _userModel=_interopRequireDefault(require("../model/userModel"));var _TimeStampService=_interopRequireDefault(require("./TimeStampService"));var _BuddyCache=_interopRequireDefault(require("../cache/BuddyCache"));var _commonUtil=require("../utils/commonUtil");var _ChatCache=_interopRequireDefault(require("../cache/ChatCache"));var _MyselfService=_interopRequireDefault(require("./MyselfService"));/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _userModel=_interopRequireDefault(require("../model/userModel"));var _TimeStampService=_interopRequireDefault(require("./TimeStampService"));var _BuddyCache=_interopRequireDefault(require("../cache/BuddyCache"));var _commonUtil=require("../utils/commonUtil");var _ChatCache=_interopRequireDefault(require("../cache/ChatCache"));var _MyselfService=_interopRequireDefault(require("./MyselfService"));var _MessageCache=_interopRequireDefault(require("../cache/MessageCache"));var _GroupMessageCache=_interopRequireDefault(require("../cache/GroupMessageCache"));var _GroupMemberService=_interopRequireDefault(require("./GroupMemberService"));/**
2
2
  * 好友缓存
3
- */var _default=new(/*#__PURE__*/function(){function BuddyService(){(0,_classCallCheck2.default)(this,BuddyService)}(0,_createClass2.default)(BuddyService,[{key:"updateBuddyCache",value:/**
3
+ */var _default=new(/*#__PURE__*/function(){function BuddyService(){(0,_classCallCheck2.default)(this,BuddyService)}(0,_createClass2.default)(BuddyService,[{key:"updateBuddyCache",/**
4
4
  * 更新修改好友缓存
5
5
  * @param {*} user
6
6
  * @param {*} timestamp
7
- */function(){var _updateBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(user,timestamp){return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return this.updateBuddysIDTimestamp(user.page,timestamp);case 2:_context.next=4;return _ChatCache.default.setChat({chatID:user.userID,title:user.remark||user.name,user:user});case 4:return _context.abrupt("return",_BuddyCache.default.updateBuddy(user));case 5:case"end":return _context.stop();}},_callee,this)}));function updateBuddyCache(_x,_x2){return _updateBuddyCache.apply(this,arguments)}return updateBuddyCache}()/**
7
+ */value:function(){var _updateBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(user,timestamp){var chat,buuddy,newBuuddy;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return this.updateBuddysIDTimestamp(user.page,timestamp);case 2:_context.next=4;return _ChatCache.default.getChat(user.userID);case 4:chat=_context.sent;if(!chat){_context.next=11;break}chat.title=user.remark||user.name||chat.title;chat.header=user.portraitURL||chat.header;(0,_commonUtil.assignIgnoreEmpty)(chat.user,user);_context.next=11;return _ChatCache.default.setChat(chat);case 11:_context.next=13;return _BuddyCache.default.getBuddy(user.userID);case 13:buuddy=_context.sent;newBuuddy=(0,_commonUtil.assignIgnoreEmpty)(buuddy||{},user);_context.next=17;return _MessageCache.default.updateMessageBySendUserIdForUser(newBuuddy.userID,newBuuddy);case 17:_context.next=19;return _GroupMessageCache.default.updateMessageBySendUserIdForUser(newBuuddy.userID,newBuuddy);case 19:_context.next=21;return _GroupMemberService.default.updateGroupMemberBySendUserId(newBuuddy.userID,newBuuddy);case 21:return _context.abrupt("return",_BuddyCache.default.updateBuddy(newBuuddy));case 22:case"end":return _context.stop();}}},_callee,this)}));function updateBuddyCache(_x,_x2){return _updateBuddyCache.apply(this,arguments)}return updateBuddyCache}()/**
8
8
  * 响应添加好友缓存
9
9
  * @param {*} user
10
10
  * @param {*} timestamp
11
- */},{key:"addBuddyCache",value:function(){var _addBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(user,timestamp){var localBuddy;return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:user.loggedUserID=_userModel.default.userID;// 更新好友分页时间戳
12
- _context2.next=3;return this.updateBuddysIDTimestamp(user.page,timestamp);case 3:_context2.next=5;return this.getBuddyCacheById(user.userID);case 5:localBuddy=_context2.sent;if(!localBuddy){_context2.next=10;break}return _context2.abrupt("return",_BuddyCache.default.updateBuddy(user));case 10:return _context2.abrupt("return",_BuddyCache.default.addBuddy(user));case 11:case"end":return _context2.stop();}},_callee2,this)}));function addBuddyCache(_x3,_x4){return _addBuddyCache.apply(this,arguments)}return addBuddyCache}()/**
11
+ */},{key:"addBuddyCache",value:function(){var _addBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(user,timestamp){var localBuddy;return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:user.loggedUserID=_userModel.default.userID;// 更新好友分页时间戳
12
+ _context2.next=3;return this.updateBuddysIDTimestamp(user.page,timestamp);case 3:_context2.next=5;return this.getBuddyCacheById(user.userID);case 5:localBuddy=_context2.sent;if(!localBuddy){_context2.next=10;break}return _context2.abrupt("return",_BuddyCache.default.updateBuddy(user));case 10:return _context2.abrupt("return",_BuddyCache.default.addBuddy(user));case 11:case"end":return _context2.stop();}}},_callee2,this)}));function addBuddyCache(_x3,_x4){return _addBuddyCache.apply(this,arguments)}return addBuddyCache}()/**
13
13
  * 更新删除好友缓存
14
14
  * @param {*} user
15
15
  * @param {*} timestamp
16
- */},{key:"deleteBuddyCache",value:function(){var _deleteBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(user,timestamp){return _regenerator.default.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return this.updateBuddysIDTimestamp(user.page,timestamp);case 2:_context3.next=4;return _ChatCache.default.deleteChat(user.userID);case 4:return _context3.abrupt("return",_BuddyCache.default.deleteBuddy(user));case 5:case"end":return _context3.stop();}},_callee3,this)}));function deleteBuddyCache(_x5,_x6){return _deleteBuddyCache.apply(this,arguments)}return deleteBuddyCache}()/**
16
+ */},{key:"deleteBuddyCache",value:function(){var _deleteBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(user,timestamp){return _regenerator.default.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return this.updateBuddysIDTimestamp(user.page,timestamp);case 2:_context3.next=4;return _ChatCache.default.deleteChat(user.userID);case 4:return _context3.abrupt("return",_BuddyCache.default.deleteBuddy(user));case 5:case"end":return _context3.stop();}}},_callee3,this)}));function deleteBuddyCache(_x5,_x6){return _deleteBuddyCache.apply(this,arguments)}return deleteBuddyCache}()/**
17
17
  * 删除好友缓存
18
18
  * @param {*} user
19
- */},{key:"deleteBuddy",value:function(){var _deleteBuddy=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(user){return _regenerator.default.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return _ChatCache.default.deleteChat(user.userID);case 2:return _context4.abrupt("return",_BuddyCache.default.deleteBuddy(user));case 3:case"end":return _context4.stop();}},_callee4)}));function deleteBuddy(_x7){return _deleteBuddy.apply(this,arguments)}return deleteBuddy}()/**
19
+ */},{key:"deleteBuddy",value:function(){var _deleteBuddy=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(user){return _regenerator.default.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return _ChatCache.default.deleteChat(user.userID);case 2:return _context4.abrupt("return",_BuddyCache.default.deleteBuddy(user));case 3:case"end":return _context4.stop();}}},_callee4)}));function deleteBuddy(_x7){return _deleteBuddy.apply(this,arguments)}return deleteBuddy}()/**
20
20
  * 更新好友缓存
21
21
  * @param {*} user
22
22
  */},{key:"updateBuddy",value:function updateBuddy(user){return _BuddyCache.default.updateBuddy(user)}/**
@@ -29,19 +29,19 @@ _context2.next=3;return this.updateBuddysIDTimestamp(user.page,timestamp);case 3
29
29
  * 优先本地缓存查询,如果没有则发送请求查询
30
30
  * @param userID
31
31
  * @returns {Promise.<*>}
32
- */},{key:"getBuddy",value:function(){var _getBuddy=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(userID){var user,userInfo;return _regenerator.default.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:if(!(userID==0)){_context5.next=2;break}return _context5.abrupt("return",null);case 2:if(!(userID==_userModel.default.userID)){_context5.next=4;break}return _context5.abrupt("return",_MyselfService.default.getMyselfCache(userID));case 4:_context5.next=6;return this.getBuddyCacheById(userID);case 6:user=_context5.sent;if(user){_context5.next=12;break}_context5.next=10;return(0,_thriftClient.serviceClient)("getUser",true,userID);case 10:userInfo=_context5.sent;user=userInfo.ub;case 12:return _context5.abrupt("return",user);case 13:case"end":return _context5.stop();}},_callee5,this)}));function getBuddy(_x8){return _getBuddy.apply(this,arguments)}return getBuddy}()/**
32
+ */},{key:"getBuddy",value:function(){var _getBuddy=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(userID){var user,userInfo;return _regenerator.default.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:if(!(userID==0)){_context5.next=2;break}return _context5.abrupt("return",null);case 2:if(!(userID==_userModel.default.userID)){_context5.next=4;break}return _context5.abrupt("return",_MyselfService.default.getMyselfCache(userID));case 4:_context5.next=6;return this.getBuddyCacheById(userID);case 6:user=_context5.sent;if(user){_context5.next=12;break}_context5.next=10;return(0,_thriftClient.serviceClient)("getUser",true,userID);case 10:userInfo=_context5.sent;user=userInfo.ub;case 12:return _context5.abrupt("return",user);case 13:case"end":return _context5.stop();}}},_callee5,this)}));function getBuddy(_x8){return _getBuddy.apply(this,arguments)}return getBuddy}()/**
33
33
  * 获取服务器所有最新分页好友数据
34
34
  * @param {*} page
35
- */},{key:"getServerBuddyList",value:function(){var _getServerBuddyList=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(page){var buddyList,i,res;return _regenerator.default.wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:buddyList=[];// 获取变动分页好友信息
35
+ */},{key:"getServerBuddyList",value:function(){var _getServerBuddyList=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(page){var buddyList,i,res;return _regenerator.default.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:buddyList=[];// 获取变动分页好友信息
36
36
  i=0;case 2:if(!(i<page.length)){_context6.next=10;break}_context6.next=5;return(0,_thriftClient.serviceClient)("getBuddy",true,page[i]);case 5:res=_context6.sent;buddyList=buddyList.concat(res.tub===null?[]:res.tub);case 7:i++;_context6.next=2;break;case 10:// 绑定当前用户与好友关系
37
- buddyList.map(function(item){return item.loggedUserID=_userModel.default.userID});return _context6.abrupt("return",buddyList);case 12:case"end":return _context6.stop();}},_callee6)}));function getServerBuddyList(_x9){return _getServerBuddyList.apply(this,arguments)}return getServerBuddyList}()/**
37
+ buddyList.map(function(item){return item.loggedUserID=_userModel.default.userID});return _context6.abrupt("return",buddyList);case 12:case"end":return _context6.stop();}}},_callee6)}));function getServerBuddyList(_x9){return _getServerBuddyList.apply(this,arguments)}return getServerBuddyList}()/**
38
38
  * 获取服务器最新分页好友数据
39
39
  * @param {*} page
40
- */},{key:"getServerBuddyListByPage",value:function(){var _getServerBuddyListByPage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(page){var res,buddyList;return _regenerator.default.wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:_context7.next=2;return(0,_thriftClient.serviceClient)("getBuddy",true,page);case 2:res=_context7.sent;buddyList=res&&res.tub[0]?res.tub:[];// 处理成本地存储缓存数据
41
- buddyList.map(function(item){item.loggedUserID=_userModel.default.userID});return _context7.abrupt("return",buddyList);case 6:case"end":return _context7.stop();}},_callee7)}));function getServerBuddyListByPage(_x10){return _getServerBuddyListByPage.apply(this,arguments)}return getServerBuddyListByPage}()/**
40
+ */},{key:"getServerBuddyListByPage",value:function(){var _getServerBuddyListByPage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(page){var res,buddyList;return _regenerator.default.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return(0,_thriftClient.serviceClient)("getBuddy",true,page);case 2:res=_context7.sent;buddyList=res&&res.tub[0]?res.tub:[];// 处理成本地存储缓存数据
41
+ buddyList.map(function(item){item.loggedUserID=_userModel.default.userID});return _context7.abrupt("return",buddyList);case 6:case"end":return _context7.stop();}}},_callee7)}));function getServerBuddyListByPage(_x10){return _getServerBuddyListByPage.apply(this,arguments)}return getServerBuddyListByPage}()/**
42
42
  * 批量更新好友缓存
43
43
  * @param {*} page
44
- */},{key:"bulkUpdateBuddyCache",value:function(){var _bulkUpdateBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(page){var changes;return _regenerator.default.wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return _BuddyCache.default.deleteBuddyByPage(page);case 2:_context8.next=4;return this.getServerBuddyListByPage(page);case 4:changes=_context8.sent;return _context8.abrupt("return",this.setBuddyList(changes));case 6:case"end":return _context8.stop();}},_callee8,this)}));function bulkUpdateBuddyCache(_x11){return _bulkUpdateBuddyCache.apply(this,arguments)}return bulkUpdateBuddyCache}()/**
44
+ */},{key:"bulkUpdateBuddyCache",value:function(){var _bulkUpdateBuddyCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(page){var changes;return _regenerator.default.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.next=2;return _BuddyCache.default.deleteBuddyByPage(page);case 2:_context8.next=4;return this.getServerBuddyListByPage(page);case 4:changes=_context8.sent;return _context8.abrupt("return",this.setBuddyList(changes));case 6:case"end":return _context8.stop();}}},_callee8,this)}));function bulkUpdateBuddyCache(_x11){return _bulkUpdateBuddyCache.apply(this,arguments)}return bulkUpdateBuddyCache}()/**
45
45
  * 根据分页数更新本地缓存好友
46
46
  * @param {*} pageArr
47
47
  */},{key:"updateBuddyCacheByPage",value:function updateBuddyCacheByPage(pageArr){var _this=this;// 请求并发执行
@@ -50,8 +50,8 @@ return Promise.all(promises)}/**
50
50
  * 更新好友分页时间戳
51
51
  * @param {*} page
52
52
  * @param {*} timestamp
53
- */},{key:"updateBuddysIDTimestamp",value:function(){var _updateBuddysIDTimestamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(page,timestamp){var buddysID;return _regenerator.default.wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _TimeStampService.default.getTimeStampByKey("buddysID");case 2:buddysID=_context9.sent;// 修改当前分页时间戳
54
- buddysID[page-1]=timestamp;return _context9.abrupt("return",_TimeStampService.default.updateTimeStamp("buddysID",buddysID));case 5:case"end":return _context9.stop();}},_callee9)}));function updateBuddysIDTimestamp(_x12,_x13){return _updateBuddysIDTimestamp.apply(this,arguments)}return updateBuddysIDTimestamp}()/**
53
+ */},{key:"updateBuddysIDTimestamp",value:function(){var _updateBuddysIDTimestamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(page,timestamp){var buddysID;return _regenerator.default.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _TimeStampService.default.getTimeStampByKey("buddysID");case 2:buddysID=_context9.sent;// 修改当前分页时间戳
54
+ buddysID[page-1]=timestamp;return _context9.abrupt("return",_TimeStampService.default.updateTimeStamp("buddysID",buddysID));case 5:case"end":return _context9.stop();}}},_callee9)}));function updateBuddysIDTimestamp(_x12,_x13){return _updateBuddysIDTimestamp.apply(this,arguments)}return updateBuddysIDTimestamp}()/**
55
55
  * 设置本地缓存好友列表
56
56
  * @param {*} buddies
57
57
  */},{key:"setBuddyList",value:function setBuddyList(buddies){return _BuddyCache.default.setBuddyList(buddies)}/**
@@ -1,23 +1,23 @@
1
1
  "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _userModel=_interopRequireDefault(require("../model/userModel"));var _commonUtil=require("../utils/commonUtil");var _dictionaryConstant=_interopRequireDefault(require("../constant/dictionaryConstant"));var _BuddyService=_interopRequireDefault(require("./BuddyService"));var _GroupService=_interopRequireDefault(require("./GroupService"));var _SystemDictionaryService=_interopRequireDefault(require("./SystemDictionaryService"));var _ChatCache=_interopRequireDefault(require("../cache/ChatCache"));var _MessageService=_interopRequireDefault(require("../service/MessageService"));var _EnterpriseService=_interopRequireDefault(require("../service/EnterpriseService"));var _SubscribeService=_interopRequireDefault(require("../service/SubscribeService"));var _CommonService=_interopRequireDefault(require("../service/CommonService"));var _groupJudgeUtil=_interopRequireDefault(require("../utils/groupJudgeUtil"));var _SystemMessageCache=_interopRequireDefault(require("../cache/SystemMessageCache"));var _GroupMessageCache=_interopRequireDefault(require("../cache/GroupMessageCache"));var _MessageCache=_interopRequireDefault(require("../cache/MessageCache"));/**
2
2
  * 会话缓存
3
- */var _default=new(/*#__PURE__*/function(){function ChatService(){(0,_classCallCheck2.default)(this,ChatService)}(0,_createClass2.default)(ChatService,[{key:"getChatCacheListUnreadCount",value:/**
3
+ */var _default=new(/*#__PURE__*/function(){function ChatService(){(0,_classCallCheck2.default)(this,ChatService)}(0,_createClass2.default)(ChatService,[{key:"getChatCacheListUnreadCount",/**
4
4
  * 获取会话菜单未读消息总数
5
- */function getChatCacheListUnreadCount(){return _ChatCache.default.getChatListUnreadCount()}/**
5
+ */value:function getChatCacheListUnreadCount(){return _ChatCache.default.getChatListUnreadCount()}/**
6
6
  * 增加会话未读数计数
7
7
  * @param {*} chatID
8
- */},{key:"addChatCacheUnreadCount",value:function(){var _addChatCacheUnreadCount=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(chatID){var chat,unreadCount;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return this.getChat(chatID);case 2:chat=_context.sent;// 更新计数 + 1
9
- unreadCount=chat.unreadCount+1;return _context.abrupt("return",this.updateChatUnreadCount(chatID,unreadCount));case 5:case"end":return _context.stop();}},_callee,this)}));function addChatCacheUnreadCount(_x){return _addChatCacheUnreadCount.apply(this,arguments)}return addChatCacheUnreadCount}()/**
8
+ */},{key:"addChatCacheUnreadCount",value:function(){var _addChatCacheUnreadCount=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(chatID){var chat,unreadCount;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return this.getChat(chatID);case 2:chat=_context.sent;// 更新计数 + 1
9
+ unreadCount=chat.unreadCount+1;return _context.abrupt("return",this.updateChatUnreadCount(chatID,unreadCount));case 5:case"end":return _context.stop();}}},_callee,this)}));function addChatCacheUnreadCount(_x){return _addChatCacheUnreadCount.apply(this,arguments)}return addChatCacheUnreadCount}()/**
10
10
  * 更新未读数量
11
11
  * @param chatID
12
12
  * @param unreadCount
13
13
  * @returns {Dexie.Promise<number>}
14
- */},{key:"updateChatUnreadCount",value:function(){var _updateChatUnreadCount=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(chatID,unreadCount){return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:return _context2.abrupt("return",_ChatCache.default.updateChatUnreadCount(chatID,unreadCount));case 1:case"end":return _context2.stop();}},_callee2)}));function updateChatUnreadCount(_x2,_x3){return _updateChatUnreadCount.apply(this,arguments)}return updateChatUnreadCount}()/**
14
+ */},{key:"updateChatUnreadCount",value:function(){var _updateChatUnreadCount=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(chatID,unreadCount){return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt("return",_ChatCache.default.updateChatUnreadCount(chatID,unreadCount));case 1:case"end":return _context2.stop();}}},_callee2)}));function updateChatUnreadCount(_x2,_x3){return _updateChatUnreadCount.apply(this,arguments)}return updateChatUnreadCount}()/**
15
15
  * 清空会话未读数为0
16
16
  * @param {*} chatID
17
17
  */},{key:"resetChatCacheUnreadCount",value:function resetChatCacheUnreadCount(chatID){return _ChatCache.default.resetChatUnreadCount(chatID)}/**
18
18
  * 更新会话缓存人员信息
19
19
  * @param {*} chatID
20
- */},{key:"updateChatCacheUser",value:function(){var _updateChatCacheUser=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(chatID){var user;return _regenerator.default.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return _BuddyService.default.getBuddyCacheById(chatID);case 2:user=_context3.sent;return _context3.abrupt("return",_ChatCache.default.setChat({chatID:chatID,title:user.remark||user.name,user:user}));case 4:case"end":return _context3.stop();}},_callee3)}));function updateChatCacheUser(_x4){return _updateChatCacheUser.apply(this,arguments)}return updateChatCacheUser}()/**
20
+ */},{key:"updateChatCacheUser",value:function(){var _updateChatCacheUser=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(chatID){var user;return _regenerator.default.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return _BuddyService.default.getBuddyCacheById(chatID);case 2:user=_context3.sent;return _context3.abrupt("return",_ChatCache.default.setChat({chatID:chatID,title:user.remark||user.name,user:user}));case 4:case"end":return _context3.stop();}}},_callee3)}));function updateChatCacheUser(_x4){return _updateChatCacheUser.apply(this,arguments)}return updateChatCacheUser}()/**
21
21
  * 更新会话未读数
22
22
  * @param {*} chatID
23
23
  * @param {*} unreadCount
@@ -30,21 +30,21 @@ unreadCount=chat.unreadCount+1;return _context.abrupt("return",this.updateChatUn
30
30
  * 新建空会话缓存
31
31
  * @param {*} chatID 会话ID
32
32
  * @param {*} chatType - 类型 user group enterprise subscribe
33
- */},{key:"addEmptyChatCache",value:function(){var _addEmptyChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(chatID,chatType){var chat,localChat,group,enterprise,user,subscribe;return _regenerator.default.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:// chat会话
33
+ */},{key:"addEmptyChatCache",value:function(){var _addEmptyChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(chatID,chatType){var chat,localChat,group,enterprise,user,subscribe;return _regenerator.default.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:// chat会话
34
34
  chat={chatID:chatID,loggedUserID:_userModel.default.userID,header:"",title:"",username:"",messageContent:"",sendTime:new Date().getTime(),sendUserID:"",messageID:0,messageType:0,messageStatus:0,unreadCount:0,chatType:chatType,isTop:false};// 是否已存在当前会话
35
- _context4.next=3;return this.getChat(chatID);case 3:localChat=_context4.sent;if(!localChat){_context4.next=6;break}return _context4.abrupt("return",localChat);case 6:if(!(chatType=="group")){_context4.next=13;break}_context4.next=9;return _GroupService.default.getGroupByID(chatID);case 9:group=_context4.sent;if(group){chat.groupInfo=group;chat.header=group.groupIcon;chat.title=group.groupName}_context4.next=32;break;case 13:if(!(chatType=="enterprise")){_context4.next=20;break}_context4.next=16;return _EnterpriseService.default.getEnterpriseById(chatID);case 16:enterprise=_context4.sent;if(enterprise){chat.enterpriseInfo=enterprise;chat.header=enterprise.appIcon;chat.title=enterprise.appName}_context4.next=32;break;case 20:if(!(chatType=="user")){_context4.next=27;break}_context4.next=23;return _BuddyService.default.getBuddy(chatID);case 23:user=_context4.sent;if(user){chat.user=user;chat.header=user.portraitURL;chat.title=user.remark||user.name}_context4.next=32;break;case 27:if(!(chatType=="subscribe")){_context4.next=32;break}_context4.next=30;return _SubscribeService.default.getSubscribeById(chatID);case 30:subscribe=_context4.sent;if(subscribe){chat.subscribeInfo=subscribe;chat.header=subscribe.portraitURL;chat.title=subscribe.name}case 32:_context4.next=34;return _ChatCache.default.addChat(chat);case 34:return _context4.abrupt("return",chat);case 35:case"end":return _context4.stop();}},_callee4,this)}));function addEmptyChatCache(_x5,_x6){return _addEmptyChatCache.apply(this,arguments)}return addEmptyChatCache}()/**
35
+ _context4.next=3;return this.getChat(chatID);case 3:localChat=_context4.sent;if(!localChat){_context4.next=6;break}return _context4.abrupt("return",localChat);case 6:if(!(chatType=="group")){_context4.next=13;break}_context4.next=9;return _GroupService.default.getGroupByID(chatID);case 9:group=_context4.sent;if(group){chat.groupInfo=group;chat.header=group.groupIcon;chat.title=group.groupName}_context4.next=32;break;case 13:if(!(chatType=="enterprise")){_context4.next=20;break}_context4.next=16;return _EnterpriseService.default.getEnterpriseById(chatID);case 16:enterprise=_context4.sent;if(enterprise){chat.enterpriseInfo=enterprise;chat.header=enterprise.appIcon;chat.title=enterprise.appName}_context4.next=32;break;case 20:if(!(chatType=="user")){_context4.next=27;break}_context4.next=23;return _BuddyService.default.getBuddy(chatID);case 23:user=_context4.sent;if(user){chat.user=user;chat.header=user.portraitURL;chat.title=user.remark||user.name}_context4.next=32;break;case 27:if(!(chatType=="subscribe")){_context4.next=32;break}_context4.next=30;return _SubscribeService.default.getSubscribeById(chatID);case 30:subscribe=_context4.sent;if(subscribe){chat.subscribeInfo=subscribe;chat.header=subscribe.portraitURL;chat.title=subscribe.name}case 32:_context4.next=34;return _ChatCache.default.addChat(chat);case 34:return _context4.abrupt("return",chat);case 35:case"end":return _context4.stop();}}},_callee4,this)}));function addEmptyChatCache(_x5,_x6){return _addEmptyChatCache.apply(this,arguments)}return addEmptyChatCache}()/**
36
36
  * 新建会话缓存
37
37
  * @param {*} messageStoreBean
38
38
  * @param {*} unreadCount
39
- */},{key:"addChatCache",value:function(){var _addChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(messageStoreBean){var unreadCount,chat,_args5=arguments;return _regenerator.default.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:unreadCount=_args5.length>1&&_args5[1]!==undefined?_args5[1]:1;_context5.next=3;return this.packingChatBean(messageStoreBean,unreadCount,false);case 3:chat=_context5.sent;_context5.next=6;return _ChatCache.default.addChat(chat);case 6:return _context5.abrupt("return",_context5.sent);case 7:case"end":return _context5.stop();}},_callee5,this)}));function addChatCache(_x7){return _addChatCache.apply(this,arguments)}return addChatCache}()/**
39
+ */},{key:"addChatCache",value:function(){var _addChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(messageStoreBean){var unreadCount,chat,_args5=arguments;return _regenerator.default.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:unreadCount=_args5.length>1&&_args5[1]!==undefined?_args5[1]:1;_context5.next=3;return this.packingChatBean(messageStoreBean,unreadCount,false);case 3:chat=_context5.sent;_context5.next=6;return _ChatCache.default.addChat(chat);case 6:return _context5.abrupt("return",_context5.sent);case 7:case"end":return _context5.stop();}}},_callee5,this)}));function addChatCache(_x7){return _addChatCache.apply(this,arguments)}return addChatCache}()/**
40
40
  * 包装Chat对象
41
41
  * @param {*} messageStoreBean
42
- */},{key:"packingChatBean",value:function(){var _packingChatBean=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(messageStoreBean){var unreadCount,isTop,chat,tempChat,_args6=arguments;return _regenerator.default.wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:unreadCount=_args6.length>1&&_args6[1]!==undefined?_args6[1]:0;isTop=_args6.length>2&&_args6[2]!==undefined?_args6[2]:false;chat={chatID:messageStoreBean.chatID,loggedUserID:_userModel.default.userID,header:"",title:"",username:"",messageContent:"",sendTime:messageStoreBean.sendTime||new Date().getTime(),sendUserID:messageStoreBean.sendUserID,messageID:messageStoreBean.messageID,messageType:messageStoreBean.messageType,messageStatus:messageStoreBean.status,unreadCount:unreadCount,chatType:messageStoreBean.chatType,isTop:isTop};// 是否系统消息
42
+ */},{key:"packingChatBean",value:function(){var _packingChatBean=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(messageStoreBean){var unreadCount,isTop,chat,tempChat,_args6=arguments;return _regenerator.default.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:unreadCount=_args6.length>1&&_args6[1]!==undefined?_args6[1]:0;isTop=_args6.length>2&&_args6[2]!==undefined?_args6[2]:false;chat={chatID:messageStoreBean.chatID,loggedUserID:_userModel.default.userID,header:"",title:"",username:"",messageContent:"",sendTime:messageStoreBean.sendTime||new Date().getTime(),sendUserID:messageStoreBean.sendUserID,messageID:messageStoreBean.messageID,messageType:messageStoreBean.messageType,messageStatus:messageStoreBean.status,unreadCount:unreadCount,chatType:messageStoreBean.chatType,isTop:isTop};// 是否系统消息
43
43
  tempChat={};if(!(messageStoreBean.messageType===100)){_context6.next=8;break}chat.title="SystemMessage";_context6.next=11;break;case 8:_context6.next=10;return this.processChatMessage(messageStoreBean);case 10:tempChat=_context6.sent;case 11:// 获取会话消息内容
44
- chat.messageContent=this.processChatMessageContent(messageStoreBean);chat=(0,_commonUtil.merge)(chat,tempChat);return _context6.abrupt("return",chat);case 14:case"end":return _context6.stop();}},_callee6,this)}));function packingChatBean(_x8){return _packingChatBean.apply(this,arguments)}return packingChatBean}()/**
44
+ chat.messageContent=this.processChatMessageContent(messageStoreBean);chat=(0,_commonUtil.merge)(chat,tempChat);return _context6.abrupt("return",chat);case 14:case"end":return _context6.stop();}}},_callee6,this)}));function packingChatBean(_x8){return _packingChatBean.apply(this,arguments)}return packingChatBean}()/**
45
45
  * 处理接收消息会话名称和头像
46
46
  * @param {*} messageStoreBean
47
- */},{key:"processChatMessage",value:function(){var _processChatMessage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(messageStoreBean){var chat,messageStoreCopyBean,user;return _regenerator.default.wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:// A.chat会话
47
+ */},{key:"processChatMessage",value:function(){var _processChatMessage=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(messageStoreBean){var chat,messageStoreCopyBean,user;return _regenerator.default.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:// A.chat会话
48
48
  chat={},messageStoreCopyBean=Object.assign({},messageStoreBean);// B.消息类型判断,群消息 / 好友消息 / 企业号 / 其他端消息同步
49
49
  if(!(messageStoreCopyBean.chatType=="group")){_context7.next=11;break}// 群信息
50
50
  chat.header=messageStoreCopyBean.groupInfo.groupIcon;chat.title=messageStoreCopyBean.groupInfo.groupName;chat.groupInfo=messageStoreCopyBean.groupInfo;chat.user=messageStoreCopyBean.user;// 发送者信息
@@ -52,7 +52,7 @@ _context7.next=8;return _MessageService.default.getMessageRemark(messageStoreCop
52
52
  chat.header=messageStoreCopyBean.enterpriseInfo.appIcon;chat.title=messageStoreCopyBean.enterpriseInfo.appName;chat.enterpriseInfo=messageStoreCopyBean.enterpriseInfo;if(messageStoreCopyBean.source=="send"){chat.user=messageStoreCopyBean.user;chat.username=messageStoreCopyBean.user.name}else{chat.username=messageStoreCopyBean.enterpriseInfo.appName}_context7.next=41;break;case 18:if(!(messageStoreCopyBean.chatType=="subscribe")){_context7.next=25;break}// 订阅号
53
53
  chat.header=messageStoreCopyBean.subscribeInfo.appIcon;chat.title=messageStoreCopyBean.subscribeInfo.name;chat.subscribeInfo=messageStoreCopyBean.subscribeInfo;if(messageStoreCopyBean.source=="send"){chat.user=messageStoreCopyBean.user;chat.username=messageStoreCopyBean.user.name}else{chat.username=messageStoreCopyBean.subscribeInfo.name}_context7.next=41;break;case 25:if(!(messageStoreCopyBean.chatType=="user")){_context7.next=41;break}//好友
54
54
  chat.header=messageStoreCopyBean.user.portraitURL;chat.user=messageStoreCopyBean.user;//如果为自己发送
55
- if(!(messageStoreCopyBean.source=="send")){_context7.next=35;break}_context7.next=31;return _BuddyService.default.getBuddy(messageStoreCopyBean.chatID);case 31:user=_context7.sent;chat.title=user.remark||user.name;_context7.next=38;break;case 35:_context7.next=37;return _MessageService.default.getMessageRemark(messageStoreCopyBean);case 37:chat.title=_context7.sent;case 38:_context7.next=40;return _MessageService.default.getMessageRemark(messageStoreCopyBean);case 40:chat.username=_context7.sent;case 41:return _context7.abrupt("return",chat);case 42:case"end":return _context7.stop();}},_callee7)}));function processChatMessage(_x9){return _processChatMessage.apply(this,arguments)}return processChatMessage}()/**
55
+ if(!(messageStoreCopyBean.source=="send")){_context7.next=35;break}_context7.next=31;return _BuddyService.default.getBuddy(messageStoreCopyBean.chatID);case 31:user=_context7.sent;chat.title=user.remark||user.name;_context7.next=38;break;case 35:_context7.next=37;return _MessageService.default.getMessageRemark(messageStoreCopyBean);case 37:chat.title=_context7.sent;case 38:_context7.next=40;return _MessageService.default.getMessageRemark(messageStoreCopyBean);case 40:chat.username=_context7.sent;case 41:return _context7.abrupt("return",chat);case 42:case"end":return _context7.stop();}}},_callee7)}));function processChatMessage(_x9){return _processChatMessage.apply(this,arguments)}return processChatMessage}()/**
56
56
  * 处理会话消息内容
57
57
  * @param {*} messageStoreBean
58
58
  */},{key:"processChatMessageContent",value:function processChatMessageContent(messageStoreBean){var messageContent="";var messageType=messageStoreBean.messageType;switch(messageType){// 文本消息类型: 包含文字、表情、抖一抖
@@ -69,13 +69,13 @@ case 64:break;// 系统消息
69
69
  case 100:messageContent="[\u7CFB\u7EDF\u6D88\u606F]";break;default:messageContent="[\u4E0D\u652F\u6301\u7684\u6D88\u606F]";}return messageContent}/**
70
70
  * 接收消息后更新会话缓存
71
71
  * @param {*} messageStoreBean
72
- */},{key:"updateChatCache",value:function(){var _updateChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(messageStoreBean){var localChat,activeChatID,unreadCount,chat;return _regenerator.default.wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return this.getChat(messageStoreBean.chatID);case 2:localChat=_context8.sent;if(!localChat){_context8.next=22;break}_context8.next=6;return _SystemDictionaryService.default.getSystemDictionaryValueByKey(_dictionaryConstant.default.activeChatID);case 6:activeChatID=_context8.sent;unreadCount=localChat.unreadCount;if(!(activeChatID==messageStoreBean.chatID||messageStoreBean.source=="send")){_context8.next=14;break}_context8.next=11;return _CommonService.default.setMessageForRead(messageStoreBean.chatID,messageStoreBean.messageID);case 11:unreadCount=0;_context8.next=15;break;case 14:unreadCount=++unreadCount;case 15:_context8.next=17;return this.packingChatBean(messageStoreBean,unreadCount,localChat.isTop);case 17:chat=_context8.sent;_context8.next=20;return _ChatCache.default.setChat(chat);case 20:_context8.next=24;break;case 22:_context8.next=24;return this.addChatCache(messageStoreBean);case 24:case"end":return _context8.stop();}},_callee8,this)}));function updateChatCache(_x10){return _updateChatCache.apply(this,arguments)}return updateChatCache}()/**
72
+ */},{key:"updateChatCache",value:function(){var _updateChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(messageStoreBean){var localChat,activeChatID,unreadCount,chat;return _regenerator.default.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.next=2;return this.getChat(messageStoreBean.chatID);case 2:localChat=_context8.sent;if(!localChat){_context8.next=22;break}_context8.next=6;return _SystemDictionaryService.default.getSystemDictionaryValueByKey(_dictionaryConstant.default.activeChatID);case 6:activeChatID=_context8.sent;unreadCount=localChat.unreadCount;if(!(activeChatID==messageStoreBean.chatID||messageStoreBean.source=="send")){_context8.next=14;break}_context8.next=11;return _CommonService.default.setMessageForRead(messageStoreBean.chatID,messageStoreBean.messageID);case 11:unreadCount=0;_context8.next=15;break;case 14:unreadCount=++unreadCount;case 15:_context8.next=17;return this.packingChatBean(messageStoreBean,unreadCount,localChat.isTop);case 17:chat=_context8.sent;_context8.next=20;return _ChatCache.default.setChat(chat);case 20:_context8.next=24;break;case 22:_context8.next=24;return this.addChatCache(messageStoreBean);case 24:case"end":return _context8.stop();}}},_callee8,this)}));function updateChatCache(_x10){return _updateChatCache.apply(this,arguments)}return updateChatCache}()/**
73
73
  * 更新离线会话缓存
74
74
  * @param {*} messageStoreBean
75
- */},{key:"updateOfflineChatCache",value:function(){var _updateOfflineChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(messageStoreBean,unreadCount){var localChat,chat;return _regenerator.default.wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_context9.next=2;return this.getChat(messageStoreBean.chatID);case 2:localChat=_context9.sent;if(!localChat){_context9.next=12;break}// 更新本地会话未读数
76
- unreadCount=unreadCount+localChat.unreadCount;_context9.next=7;return this.packingChatBean(messageStoreBean,unreadCount,localChat.isTop);case 7:chat=_context9.sent;_context9.next=10;return _ChatCache.default.setChat(chat);case 10:_context9.next=14;break;case 12:_context9.next=14;return this.addChatCache(messageStoreBean,unreadCount);case 14:case"end":return _context9.stop();}},_callee9,this)}));function updateOfflineChatCache(_x11,_x12){return _updateOfflineChatCache.apply(this,arguments)}return updateOfflineChatCache}()/**
75
+ */},{key:"updateOfflineChatCache",value:function(){var _updateOfflineChatCache=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(messageStoreBean,unreadCount){var localChat,chat;return _regenerator.default.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return this.getChat(messageStoreBean.chatID);case 2:localChat=_context9.sent;if(!localChat){_context9.next=12;break}// 更新本地会话未读数
76
+ unreadCount=unreadCount+localChat.unreadCount;_context9.next=7;return this.packingChatBean(messageStoreBean,unreadCount,localChat.isTop);case 7:chat=_context9.sent;_context9.next=10;return _ChatCache.default.setChat(chat);case 10:_context9.next=14;break;case 12:_context9.next=14;return this.addChatCache(messageStoreBean,unreadCount);case 14:case"end":return _context9.stop();}}},_callee9,this)}));function updateOfflineChatCache(_x11,_x12){return _updateOfflineChatCache.apply(this,arguments)}return updateOfflineChatCache}()/**
77
77
  * 获取缓存会话列表
78
- */},{key:"getChatList",value:function(){var _getChatList=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10(){var chatList,chatArr;return _regenerator.default.wrap(function _callee10$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_context10.next=2;return _ChatCache.default.getChatList();case 2:chatList=_context10.sent;chatArr=chatList.sort(function(a1,a2){if(a1.isTop&&a2.isTop){return a2.sendTime-a1.sendTime}else if(a1.isTop){return-1}else if(a2.isTop){return 1}else{return a2.sendTime-a1.sendTime}});return _context10.abrupt("return",chatArr);case 5:case"end":return _context10.stop();}},_callee10)}));function getChatList(){return _getChatList.apply(this,arguments)}return getChatList}()/**
78
+ */},{key:"getChatList",value:function(){var _getChatList=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10(){var chatList,chatArr;return _regenerator.default.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.next=2;return _ChatCache.default.getChatList();case 2:chatList=_context10.sent;chatArr=chatList.sort(function(a1,a2){if(a1.isTop&&a2.isTop){return a2.sendTime-a1.sendTime}else if(a1.isTop){return-1}else if(a2.isTop){return 1}else{return a2.sendTime-a1.sendTime}});return _context10.abrupt("return",chatArr);case 5:case"end":return _context10.stop();}}},_callee10)}));function getChatList(){return _getChatList.apply(this,arguments)}return getChatList}()/**
79
79
  * 根据chatID获取本地会话缓存
80
80
  * @param {*} chatID
81
81
  */},{key:"getChat",value:function getChat(chatID){return _ChatCache.default.getChat(chatID)}/**
@@ -93,6 +93,6 @@ unreadCount=unreadCount+localChat.unreadCount;_context9.next=7;return this.packi
93
93
  */},{key:"updateChatGroup",value:function updateChatGroup(chatID,groupInfo){return _ChatCache.default.updateChatGroup(chatID,groupInfo)}/**
94
94
  * 设置当前激活会话ID
95
95
  * @param {number} chatID
96
- */},{key:"setActiveChatID",value:function(){var _setActiveChatID=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(chatID){var messageObj;return _regenerator.default.wrap(function _callee11$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:// 根据chatID设置当前会话为已读状态
96
+ */},{key:"setActiveChatID",value:function(){var _setActiveChatID=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(chatID){var messageObj;return _regenerator.default.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:// 根据chatID设置当前会话为已读状态
97
97
  chatID=chatID||0;messageObj=null;//获取最大消息信息
98
- _context11.t0=chatID;_context11.next=_context11.t0===0?5:_context11.t0===10000?6:10;break;case 5:return _context11.abrupt("break",19);case 6:_context11.next=8;return _SystemMessageCache.default.getLastSystemMessage();case 8:messageObj=_context11.sent;return _context11.abrupt("break",19);case 10:if(!_groupJudgeUtil.default.isGroup(chatID)){_context11.next=16;break}_context11.next=13;return _GroupMessageCache.default.getLastGroupMessage(chatID);case 13:messageObj=_context11.sent;_context11.next=19;break;case 16:_context11.next=18;return _MessageCache.default.getLastMessage(chatID);case 18:messageObj=_context11.sent;case 19:if(!messageObj){_context11.next=22;break}_context11.next=22;return _CommonService.default.setMessageForRead(chatID,messageObj.messageID);case 22:_context11.next=24;return this.resetChatCacheUnreadCount(chatID);case 24:return _context11.abrupt("return",_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.activeChatID,chatID));case 25:case"end":return _context11.stop();}},_callee11,this)}));function setActiveChatID(_x13){return _setActiveChatID.apply(this,arguments)}return setActiveChatID}()}]);return ChatService}());exports.default=_default;
98
+ _context11.t0=chatID;_context11.next=_context11.t0===0?5:_context11.t0===10000?6:10;break;case 5:return _context11.abrupt("break",19);case 6:_context11.next=8;return _SystemMessageCache.default.getLastSystemMessage();case 8:messageObj=_context11.sent;return _context11.abrupt("break",19);case 10:if(!_groupJudgeUtil.default.isGroup(chatID)){_context11.next=16;break}_context11.next=13;return _GroupMessageCache.default.getLastGroupMessage(chatID);case 13:messageObj=_context11.sent;_context11.next=19;break;case 16:_context11.next=18;return _MessageCache.default.getLastMessage(chatID);case 18:messageObj=_context11.sent;case 19:if(!messageObj){_context11.next=22;break}_context11.next=22;return _CommonService.default.setMessageForRead(chatID,messageObj.messageID);case 22:_context11.next=24;return this.resetChatCacheUnreadCount(chatID);case 24:return _context11.abrupt("return",_SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.activeChatID,chatID));case 25:case"end":return _context11.stop();}}},_callee11,this)}));function setActiveChatID(_x13){return _setActiveChatID.apply(this,arguments)}return setActiveChatID}()}]);return ChatService}());exports.default=_default;
@@ -2,16 +2,16 @@
2
2
  * 公共类业务处理
3
3
  * @author 李文龙
4
4
  * @date 2020/3/13
5
- */var _default=new(/*#__PURE__*/function(){function CommonService(){(0,_classCallCheck2.default)(this,CommonService)}(0,_createClass2.default)(CommonService,[{key:"queryVerifyMessages",value:/**
5
+ */var _default=new(/*#__PURE__*/function(){function CommonService(){(0,_classCallCheck2.default)(this,CommonService)}(0,_createClass2.default)(CommonService,[{key:"queryVerifyMessages",/**
6
6
  * 消息盒子
7
- */function queryVerifyMessages(response){// 查询参数
7
+ */value:function queryVerifyMessages(response){// 查询参数
8
8
  var params=(0,_commonUtil.merge)(new VerifyMessageParam,response);return(0,_thriftClient.serviceClient)("qVerifyMessageS",true,params)}/**
9
9
  * 判断消息发送者类型
10
10
  * @param id
11
11
  * @returns {Promise<string|*>} system user group enterprise
12
- */},{key:"getMessageSendType",value:function(){var _getMessageSendType=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(id){var appInfo;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(id==0||id==10000)){_context.next=4;break}return _context.abrupt("return","system");case 4:if(!_groupJudgeUtil.default.isUser(id)){_context.next=8;break}return _context.abrupt("return","user");case 8:if(!_groupJudgeUtil.default.isGroup(id)){_context.next=12;break}return _context.abrupt("return","group");case 12:if(!_groupJudgeUtil.default.isApp(id)){_context.next=28;break}_context.next=15;return _EnterpriseService.default.getEnterpriseCacheById(id);case 15:if(!_context.sent){_context.next=19;break}return _context.abrupt("return","enterprise");case 19:_context.next=21;return _SubscribeService.default.getSubscribeCacheById(id);case 21:if(!_context.sent){_context.next=23;break}return _context.abrupt("return","subscribe");case 23:_context.next=25;return(0,_thriftClient.serviceClient)("getAppInfo",true,id);case 25:appInfo=_context.sent;if(!(appInfo&&appInfo.app)){_context.next=28;break}return _context.abrupt("return",appInfo.app.subOrAppType==1?"subscribe":"enterprise");case 28:return _context.abrupt("return",null);case 29:case"end":return _context.stop();}},_callee)}));function getMessageSendType(_x){return _getMessageSendType.apply(this,arguments)}return getMessageSendType}()/**
12
+ */},{key:"getMessageSendType",value:function(){var _getMessageSendType=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(id){var appInfo;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(id==0||id==10000)){_context.next=4;break}return _context.abrupt("return","system");case 4:if(!_groupJudgeUtil.default.isUser(id)){_context.next=8;break}return _context.abrupt("return","user");case 8:if(!_groupJudgeUtil.default.isGroup(id)){_context.next=12;break}return _context.abrupt("return","group");case 12:if(!_groupJudgeUtil.default.isApp(id)){_context.next=28;break}_context.next=15;return _EnterpriseService.default.getEnterpriseCacheById(id);case 15:if(!_context.sent){_context.next=19;break}return _context.abrupt("return","enterprise");case 19:_context.next=21;return _SubscribeService.default.getSubscribeCacheById(id);case 21:if(!_context.sent){_context.next=23;break}return _context.abrupt("return","subscribe");case 23:_context.next=25;return(0,_thriftClient.serviceClient)("getAppInfo",true,id);case 25:appInfo=_context.sent;if(!(appInfo&&appInfo.app)){_context.next=28;break}return _context.abrupt("return",appInfo.app.subOrAppType==1?"subscribe":"enterprise");case 28:return _context.abrupt("return",null);case 29:case"end":return _context.stop();}}},_callee)}));function getMessageSendType(_x){return _getMessageSendType.apply(this,arguments)}return getMessageSendType}()/**
13
13
  * 设置已读消息ID
14
14
  * @param targetID
15
15
  * @param messageID
16
16
  * @returns {Promise<unknown>}
17
- */},{key:"setMessageForRead",value:function(){var _setMessageForRead=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(targetID,messageID){return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:return _context2.abrupt("return",(0,_thriftClient.serviceClient)("setMessageForRead",true,targetID,messageID));case 1:case"end":return _context2.stop();}},_callee2)}));function setMessageForRead(_x2,_x3){return _setMessageForRead.apply(this,arguments)}return setMessageForRead}()}]);return CommonService}());exports.default=_default;
17
+ */},{key:"setMessageForRead",value:function(){var _setMessageForRead=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(targetID,messageID){return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt("return",(0,_thriftClient.serviceClient)("setMessageForRead",true,targetID,messageID));case 1:case"end":return _context2.stop();}}},_callee2)}));function setMessageForRead(_x2,_x3){return _setMessageForRead.apply(this,arguments)}return setMessageForRead}()}]);return CommonService}());exports.default=_default;
@@ -1,32 +1,32 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _SystemDictionaryService=_interopRequireDefault(require("./SystemDictionaryService"));var _dictionaryConstant=_interopRequireDefault(require("../constant/dictionaryConstant"));var _userModel=_interopRequireDefault(require("../model/userModel"));var _EnterpriseCache=_interopRequireDefault(require("../cache/EnterpriseCache"));function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _thriftClient=require("../thrift/thriftClient");var _SystemDictionaryService=_interopRequireDefault(require("./SystemDictionaryService"));var _dictionaryConstant=_interopRequireDefault(require("../constant/dictionaryConstant"));var _userModel=_interopRequireDefault(require("../model/userModel"));var _EnterpriseCache=_interopRequireDefault(require("../cache/EnterpriseCache"));function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}/**
2
2
  * 企业号业务处理
3
3
  * @author 李文龙
4
4
  * @date 2020/5/13
5
- */var _default=new(/*#__PURE__*/function(){function EnterpriseService(){(0,_classCallCheck2.default)(this,EnterpriseService)}(0,_createClass2.default)(EnterpriseService,[{key:"getServiceEnterpriseTimeStamp",value:/**
5
+ */var _default=new(/*#__PURE__*/function(){function EnterpriseService(){(0,_classCallCheck2.default)(this,EnterpriseService)}(0,_createClass2.default)(EnterpriseService,[{key:"getServiceEnterpriseTimeStamp",/**
6
6
  * 获取服务器公共号时间戳
7
7
  * @returns {Promise<*>}
8
- */function(){var _getServiceEnterpriseTimeStamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var pltFParam,res;return _regenerator.default.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:pltFParam=new PltFParam;pltFParam.type=14;_context.next=4;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 4:res=_context.sent;_context.next=7;return _SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.enterpriseTimeStamp,res.what);case 7:return _context.abrupt("return",res.what);case 8:case"end":return _context.stop();}},_callee)}));function getServiceEnterpriseTimeStamp(){return _getServiceEnterpriseTimeStamp.apply(this,arguments)}return getServiceEnterpriseTimeStamp}()/**
8
+ */value:function(){var _getServiceEnterpriseTimeStamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var pltFParam,res;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:pltFParam=new PltFParam;pltFParam.type=14;_context.next=4;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 4:res=_context.sent;_context.next=7;return _SystemDictionaryService.default.setSystemDictionaryValue(_dictionaryConstant.default.enterpriseTimeStamp,res.what);case 7:return _context.abrupt("return",res.what);case 8:case"end":return _context.stop();}}},_callee)}));function getServiceEnterpriseTimeStamp(){return _getServiceEnterpriseTimeStamp.apply(this,arguments)}return getServiceEnterpriseTimeStamp}()/**
9
9
  * 获取本地缓存公共号时间戳
10
10
  * @returns {Dexie.Promise<*|T>|Dexie.Promise<*>}
11
11
  */},{key:"getCacheEnterpriseTimeStamp",value:function getCacheEnterpriseTimeStamp(){return _SystemDictionaryService.default.getSystemDictionaryValueByKey(_dictionaryConstant.default.enterpriseTimeStamp)}/**
12
12
  * 获取公共号时间戳
13
13
  * @returns {Promise<*>}
14
- */},{key:"getEnterpriseTimeStamp",value:function(){var _getEnterpriseTimeStamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(){var timeStamp;return _regenerator.default.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.getCacheEnterpriseTimeStamp();case 2:timeStamp=_context2.sent;if(timeStamp){_context2.next=7;break}_context2.next=6;return this.getServiceEnterpriseTimeStamp();case 6:timeStamp=_context2.sent;case 7:return _context2.abrupt("return",timeStamp);case 8:case"end":return _context2.stop();}},_callee2,this)}));function getEnterpriseTimeStamp(){return _getEnterpriseTimeStamp.apply(this,arguments)}return getEnterpriseTimeStamp}()/**
14
+ */},{key:"getEnterpriseTimeStamp",value:function(){var _getEnterpriseTimeStamp=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(){var timeStamp;return _regenerator.default.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.getCacheEnterpriseTimeStamp();case 2:timeStamp=_context2.sent;if(timeStamp){_context2.next=7;break}_context2.next=6;return this.getServiceEnterpriseTimeStamp();case 6:timeStamp=_context2.sent;case 7:return _context2.abrupt("return",timeStamp);case 8:case"end":return _context2.stop();}}},_callee2,this)}));function getEnterpriseTimeStamp(){return _getEnterpriseTimeStamp.apply(this,arguments)}return getEnterpriseTimeStamp}()/**
15
15
  * 获取服务器企业号数据信息
16
- */},{key:"getServiceEnterprise",value:function(){var _getServiceEnterprise=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(appIds){var pltFParam,res;return _regenerator.default.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:pltFParam=new PltFParam;pltFParam.type=13;pltFParam.appIdList=appIds;_context3.next=5;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 5:res=_context3.sent;res.listEntAppInfo.forEach(function(item){return item.loggedUserID=_userModel.default.userID});return _context3.abrupt("return",res.listEntAppInfo);case 8:case"end":return _context3.stop();}},_callee3)}));function getServiceEnterprise(_x){return _getServiceEnterprise.apply(this,arguments)}return getServiceEnterprise}()/**
16
+ */},{key:"getServiceEnterprise",value:function(){var _getServiceEnterprise=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(appIds){var pltFParam,res;return _regenerator.default.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:pltFParam=new PltFParam;pltFParam.type=13;pltFParam.appIdList=appIds;_context3.next=5;return(0,_thriftClient.serviceClient)("qPltFS",true,pltFParam);case 5:res=_context3.sent;res.listEntAppInfo.forEach(function(item){return item.loggedUserID=_userModel.default.userID});return _context3.abrupt("return",res.listEntAppInfo);case 8:case"end":return _context3.stop();}}},_callee3)}));function getServiceEnterprise(_x){return _getServiceEnterprise.apply(this,arguments)}return getServiceEnterprise}()/**
17
17
  * 查询缓存企业号
18
18
  * @returns {Dexie.Promise<Array<any>>}
19
19
  */},{key:"getCacheEnterprise",value:function getCacheEnterprise(){return _EnterpriseCache.default.getEnterpriseList()}/**
20
20
  * 对比企业号时间戳更新企业号数据信息
21
21
  * @returns {Promise<void>}
22
- */},{key:"contrastetUpdateEnterprises",value:function(){var _contrastetUpdateEnterprises=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(){var cacheTimeStamp,serviceTimeStamp,cacheValue,serviceValue,addAppIds,editAppIds,appId,entList,_entList,_iterator,_step,item,removeAppId;return _regenerator.default.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return this.getCacheEnterpriseTimeStamp();case 2:cacheTimeStamp=_context4.sent;_context4.next=5;return this.getServiceEnterpriseTimeStamp();case 5:serviceTimeStamp=_context4.sent;if(!(cacheTimeStamp!=serviceTimeStamp)){_context4.next=44;break}cacheValue=JSON.parse(cacheTimeStamp||"{}"),serviceValue=JSON.parse(serviceTimeStamp||"{}");addAppIds=[],editAppIds=[];for(appId in serviceValue){if(cacheValue[appId]&&serviceValue[appId]!=cacheValue[appId]){editAppIds.push(appId);delete cacheValue[appId]}else if(cacheValue[appId]){delete cacheValue[appId]}else{addAppIds.push(appId)}}/**
22
+ */},{key:"contrastetUpdateEnterprises",value:function(){var _contrastetUpdateEnterprises=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(){var cacheTimeStamp,serviceTimeStamp,cacheValue,serviceValue,addAppIds,editAppIds,appId,entList,_entList,_iterator,_step,item,removeAppId;return _regenerator.default.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return this.getCacheEnterpriseTimeStamp();case 2:cacheTimeStamp=_context4.sent;_context4.next=5;return this.getServiceEnterpriseTimeStamp();case 5:serviceTimeStamp=_context4.sent;if(!(cacheTimeStamp!=serviceTimeStamp)){_context4.next=44;break}cacheValue=JSON.parse(cacheTimeStamp||"{}"),serviceValue=JSON.parse(serviceTimeStamp||"{}");addAppIds=[],editAppIds=[];for(appId in serviceValue){if(cacheValue[appId]&&serviceValue[appId]!=cacheValue[appId]){editAppIds.push(appId);delete cacheValue[appId]}else if(cacheValue[appId]){delete cacheValue[appId]}else{addAppIds.push(appId)}}/**
23
23
  * 新增企业号
24
- */if(!(addAppIds.length>0)){_context4.next=16;break}_context4.next=13;return this.getServiceEnterprise(addAppIds);case 13:entList=_context4.sent;_context4.next=16;return _EnterpriseCache.default.setEnterpriseList(entList);case 16:if(!(editAppIds.length>0)){_context4.next=37;break}_context4.next=19;return this.getServiceEnterprise(editAppIds);case 19:_entList=_context4.sent;_iterator=_createForOfIteratorHelper(_entList);_context4.prev=21;_iterator.s();case 23:if((_step=_iterator.n()).done){_context4.next=29;break}item=_step.value;_context4.next=27;return _EnterpriseCache.default.updateEnterprise(item);case 27:_context4.next=23;break;case 29:_context4.next=34;break;case 31:_context4.prev=31;_context4.t0=_context4["catch"](21);_iterator.e(_context4.t0);case 34:_context4.prev=34;_iterator.f();return _context4.finish(34);case 37:_context4.t1=_regenerator.default.keys(cacheValue);case 38:if((_context4.t2=_context4.t1()).done){_context4.next=44;break}removeAppId=_context4.t2.value;_context4.next=42;return _EnterpriseCache.default.deleteEnterprise(Number(removeAppId));case 42:_context4.next=38;break;case 44:case"end":return _context4.stop();}},_callee4,this,[[21,31,34,37]])}));function contrastetUpdateEnterprises(){return _contrastetUpdateEnterprises.apply(this,arguments)}return contrastetUpdateEnterprises}()/**
24
+ */if(!(addAppIds.length>0)){_context4.next=16;break}_context4.next=13;return this.getServiceEnterprise(addAppIds);case 13:entList=_context4.sent;_context4.next=16;return _EnterpriseCache.default.setEnterpriseList(entList);case 16:if(!(editAppIds.length>0)){_context4.next=37;break}_context4.next=19;return this.getServiceEnterprise(editAppIds);case 19:_entList=_context4.sent;_iterator=_createForOfIteratorHelper(_entList);_context4.prev=21;_iterator.s();case 23:if((_step=_iterator.n()).done){_context4.next=29;break}item=_step.value;_context4.next=27;return _EnterpriseCache.default.updateEnterprise(item);case 27:_context4.next=23;break;case 29:_context4.next=34;break;case 31:_context4.prev=31;_context4.t0=_context4["catch"](21);_iterator.e(_context4.t0);case 34:_context4.prev=34;_iterator.f();return _context4.finish(34);case 37:_context4.t1=_regenerator.default.keys(cacheValue);case 38:if((_context4.t2=_context4.t1()).done){_context4.next=44;break}removeAppId=_context4.t2.value;_context4.next=42;return _EnterpriseCache.default.deleteEnterprise(removeAppId);case 42:_context4.next=38;break;case 44:case"end":return _context4.stop();}}},_callee4,this,[[21,31,34,37]])}));function contrastetUpdateEnterprises(){return _contrastetUpdateEnterprises.apply(this,arguments)}return contrastetUpdateEnterprises}()/**
25
25
  * 根据userID获取缓存好友信息
26
26
  * @param {*} userID
27
27
  */},{key:"getEnterpriseCacheById",value:function getEnterpriseCacheById(appID){return _EnterpriseCache.default.getEnterpriseById(appID)}/**
28
28
  * 获取企业号单条信息
29
29
  * @param appID
30
- */},{key:"getEnterpriseById",value:function(){var _getEnterpriseById=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(appID){var enterprise,appInfoRes;return _regenerator.default.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:enterprise=_EnterpriseCache.default.getEnterpriseById(appID);if(enterprise){_context5.next=6;break}_context5.next=4;return(0,_thriftClient.serviceClient)("getAppInfo",true,appID);case 4:appInfoRes=_context5.sent;if(appInfoRes&&appInfoRes.app){enterprise=appInfoRes.app}case 6:return _context5.abrupt("return",enterprise);case 7:case"end":return _context5.stop();}},_callee5)}));function getEnterpriseById(_x2){return _getEnterpriseById.apply(this,arguments)}return getEnterpriseById}()/**
30
+ */},{key:"getEnterpriseById",value:function(){var _getEnterpriseById=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(appID){var enterprise,appInfoRes;return _regenerator.default.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:enterprise=_EnterpriseCache.default.getEnterpriseById(appID);if(enterprise){_context5.next=6;break}_context5.next=4;return(0,_thriftClient.serviceClient)("getAppInfo",true,appID);case 4:appInfoRes=_context5.sent;if(appInfoRes&&appInfoRes.app){enterprise=appInfoRes.app}case 6:return _context5.abrupt("return",enterprise);case 7:case"end":return _context5.stop();}}},_callee5)}));function getEnterpriseById(_x2){return _getEnterpriseById.apply(this,arguments)}return getEnterpriseById}()/**
31
31
  * 企业的所有放开的应用
32
- */},{key:"getEnterprise",value:function(){var _getEnterprise=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(){return _regenerator.default.wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:return _context6.abrupt("return",_EnterpriseCache.default.getEnterpriseList());case 1:case"end":return _context6.stop();}},_callee6)}));function getEnterprise(){return _getEnterprise.apply(this,arguments)}return getEnterprise}()}]);return EnterpriseService}());exports.default=_default;
32
+ */},{key:"getEnterprise",value:function(){var _getEnterprise=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(){return _regenerator.default.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:return _context6.abrupt("return",_EnterpriseCache.default.getEnterpriseList());case 1:case"end":return _context6.stop();}}},_callee6)}));function getEnterprise(){return _getEnterprise.apply(this,arguments)}return getEnterprise}()}]);return EnterpriseService}());exports.default=_default;