Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / config / schedule / chat.js
index 3c07cb2..c2adac8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf008=['../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf008,0x1c8));var _0x8f00=function(_0xec623c,_0x2d1fdb){_0xec623c=_0xec623c-0x0;var _0x148207=_0xf008[_0xec623c];return _0x148207;};'use strict';var _=require(_0x8f00('0x0'));var moment=require(_0x8f00('0x1'));var Redis=require(_0x8f00('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x8f00('0x3'));config[_0x8f00('0x4')]=_[_0x8f00('0x5')](config[_0x8f00('0x4')],{'host':_0x8f00('0x6'),'port':0x18eb});var io=require(_0x8f00('0x7'))(new Redis(config[_0x8f00('0x4')]));function closeInteractions(){var _0x7668ed=0x0;var _0x4aec62=[];return db[_0x8f00('0x8')][_0x8f00('0x9')]({'raw':!![],'attributes':['id',_0x8f00('0xa')],'where':{'id':0x1}})[_0x8f00('0xb')](function(_0x4f2182){_0x7668ed=_0x4f2182[_0x8f00('0xa')];if(_0x7668ed){return db[_0x8f00('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x8f00('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8f00('0xe')](_0x4f2182['chatTimeout'],_0x8f00('0xf'))}}});}else{return[];}})[_0x8f00('0xb')](function(_0x1c2e69){_0x4aec62=_0x1c2e69;if(_0x7668ed){return db['ChatInteraction'][_0x8f00('0x10')]({'closeReason':_0x8f00('0x11'),'disposition':_0x8f00('0x12'),'closed':!![],'closedAt':moment()['format'](_0x8f00('0x13'))},{'where':{'id':_[_0x8f00('0x14')](_0x4aec62||[],'id')}});}})[_0x8f00('0xb')](function(_0x3d2fc5){for(var _0x4b9e23=0x0;_0x4b9e23<_0x4aec62[_0x8f00('0x15')];_0x4b9e23++){io[_0x8f00('0x16')](_0x8f00('0x17'),{'id':_0x4aec62[_0x4b9e23]['id'],'closed':!![]});}})[_0x8f00('0x18')](function(_0x49553a){console[_0x8f00('0x19')](_0x49553a);});}exports[_0x8f00('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x159b=['minutes','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','emit','chatInteraction:update','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x159b,0x181));var _0xb159=function(_0x2bacbd,_0x33ebb6){_0x2bacbd=_0x2bacbd-0x0;var _0x1e07d1=_0x159b[_0x2bacbd];return _0x1e07d1;};'use strict';var _=require(_0xb159('0x0'));var moment=require(_0xb159('0x1'));var Redis=require(_0xb159('0x2'));var db=require(_0xb159('0x3'))['db'];var config=require(_0xb159('0x4'));config[_0xb159('0x5')]=_[_0xb159('0x6')](config[_0xb159('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb159('0x7'))(new Redis(config[_0xb159('0x5')]));function closeInteractions(){var _0x136fff=0x0;var _0x21186d=[];return db['Setting'][_0xb159('0x8')]({'raw':!![],'attributes':['id',_0xb159('0x9')],'where':{'id':0x1}})[_0xb159('0xa')](function(_0x329f1e){_0x136fff=_0x329f1e[_0xb159('0x9')];if(_0x136fff){return db[_0xb159('0xb')][_0xb159('0xc')]({'raw':!![],'attributes':['id',_0xb159('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb159('0xe')](_0x329f1e[_0xb159('0x9')],_0xb159('0xf'))}}});}else{return[];}})[_0xb159('0xa')](function(_0x424e93){_0x21186d=_0x424e93;if(_0x136fff){return db['ChatInteraction']['update']({'closeReason':_0xb159('0x10'),'disposition':_0xb159('0x11'),'closed':!![],'closedAt':moment()[_0xb159('0x12')](_0xb159('0x13'))},{'where':{'id':_[_0xb159('0x14')](_0x21186d||[],'id')}});}})[_0xb159('0xa')](function(_0x5cf1be){for(var _0xd9ba88=0x0;_0xd9ba88<_0x21186d['length'];_0xd9ba88++){io[_0xb159('0x15')](_0xb159('0x16'),{'id':_0x21186d[_0xd9ba88]['id'],'closed':!![]});}})['catch'](function(_0x541a50){console[_0xb159('0x17')](_0x541a50);});}exports[_0xb159('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file