Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / config / schedule / chat.js
index e30bb57..a2b9f3e 100644 (file)
@@ -1 +1 @@
-const a850_0x1214=['moment','start','YYYY-MM-DD\x20HH:mm:ss','format','length','catch','then','findOne','chatTimeout','map','Setting','lodash','../../mysqldb','emit','findAll','../../rediscache','minutes','lastMsgAt','ChatInteraction','system','timeout'];(function(_0xe26fea,_0x1214d2){const _0x4aaa29=function(_0x3bbca0){while(--_0x3bbca0){_0xe26fea['push'](_0xe26fea['shift']());}};_0x4aaa29(++_0x1214d2);}(a850_0x1214,0xa0));const a850_0x4aaa=function(_0xe26fea,_0x1214d2){_0xe26fea=_0xe26fea-0x0;let _0x4aaa29=a850_0x1214[_0xe26fea];return _0x4aaa29;};const _0x1a1730=a850_0x4aaa;'use strict';const _=require(_0x1a1730('0x13')),moment=require(_0x1a1730('0x8')),db=require(_0x1a1730('0x14'))['db'],{getSocket}=require(_0x1a1730('0x2')),io=getSocket();function closeInteractions(){const _0x5cd0b3=_0x1a1730;let _0x3bbca0=0x0,_0x19b3cb=[];return db[_0x5cd0b3('0x12')][_0x5cd0b3('0xf')]({'raw':!![],'attributes':['id',_0x5cd0b3('0x10')],'where':{'id':0x1}})[_0x5cd0b3('0xe')](function(_0xdf427a){const _0x297109=_0x5cd0b3;return _0x3bbca0=_0xdf427a[_0x297109('0x10')],_0x3bbca0?db[_0x297109('0x5')][_0x297109('0x1')]({'raw':!![],'attributes':['id',_0x297109('0x4')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xdf427a[_0x297109('0x10')],_0x297109('0x3'))}}}):[];})[_0x5cd0b3('0xe')](function(_0x3931a3){const _0x1771c5=_0x5cd0b3;_0x19b3cb=_0x3931a3;if(_0x3bbca0)return db[_0x1771c5('0x5')]['update']({'closeReason':_0x1771c5('0x6'),'disposition':_0x1771c5('0x7'),'closed':!![],'closedAt':moment()[_0x1771c5('0xb')](_0x1771c5('0xa'))},{'where':{'id':_[_0x1771c5('0x11')](_0x19b3cb||[],'id')}});})[_0x5cd0b3('0xe')](function(){const _0x40e936=_0x5cd0b3;for(let _0x3e99ef=0x0;_0x3e99ef<_0x19b3cb[_0x40e936('0xc')];_0x3e99ef++){io[_0x40e936('0x0')]('chatInteraction:update',{'id':_0x19b3cb[_0x3e99ef]['id'],'closed':!![]});}})[_0x5cd0b3('0xd')](function(_0x4612a9){console['error'](_0x4612a9);});}exports[_0x1a1730('0x9')]=function(){return setInterval(function(){return closeInteractions();},0x3c*0x3e8),closeInteractions();};
\ No newline at end of file
+const a850_0x23f1=['lastMsgAt','moment','subtract','catch','minutes','map','length','ChatInteraction','YYYY-MM-DD\x20HH:mm:ss','../../mysqldb','then','update','format','system','../../rediscache','chatTimeout','timeout','findAll','start'];(function(_0x6384f,_0x23f1f4){const _0x84d341=function(_0x3ef9e1){while(--_0x3ef9e1){_0x6384f['push'](_0x6384f['shift']());}};_0x84d341(++_0x23f1f4);}(a850_0x23f1,0x18a));const a850_0x84d3=function(_0x6384f,_0x23f1f4){_0x6384f=_0x6384f-0x0;let _0x84d341=a850_0x23f1[_0x6384f];return _0x84d341;};const _0x363e2c=a850_0x84d3;'use strict';const _=require('lodash'),moment=require(_0x363e2c('0x6')),db=require(_0x363e2c('0xe'))['db'],{getSocket}=require(_0x363e2c('0x0')),io=getSocket();function closeInteractions(){const _0x3150dc=_0x363e2c;let _0x3ef9e1=0x0,_0xde65ce=[];return db['Setting']['findOne']({'raw':!![],'attributes':['id',_0x3150dc('0x1')],'where':{'id':0x1}})[_0x3150dc('0xf')](function(_0x42b7bd){const _0x20d91e=_0x3150dc;return _0x3ef9e1=_0x42b7bd[_0x20d91e('0x1')],_0x3ef9e1?db[_0x20d91e('0xc')][_0x20d91e('0x3')]({'raw':!![],'attributes':['id',_0x20d91e('0x5')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x20d91e('0x7')](_0x42b7bd[_0x20d91e('0x1')],_0x20d91e('0x9'))}}}):[];})[_0x3150dc('0xf')](function(_0x17c3d4){const _0x3772b7=_0x3150dc;_0xde65ce=_0x17c3d4;if(_0x3ef9e1)return db['ChatInteraction'][_0x3772b7('0x10')]({'closeReason':_0x3772b7('0x12'),'disposition':_0x3772b7('0x2'),'closed':!![],'closedAt':moment()[_0x3772b7('0x11')](_0x3772b7('0xd'))},{'where':{'id':_[_0x3772b7('0xa')](_0xde65ce||[],'id')}});})[_0x3150dc('0xf')](function(){const _0x363e57=_0x3150dc;for(let _0x6abf82=0x0;_0x6abf82<_0xde65ce[_0x363e57('0xb')];_0x6abf82++){io['emit']('chatInteraction:update',{'id':_0xde65ce[_0x6abf82]['id'],'closed':!![]});}})[_0x3150dc('0x8')](function(_0x5e6d1c){console['error'](_0x5e6d1c);});}exports[_0x363e2c('0x4')]=function(){return setInterval(function(){return closeInteractions();},0x3c*0x3e8),closeInteractions();};
\ No newline at end of file