Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / config / schedule / chat.js
index 6be53f1..45dc8ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d70=['localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch','error','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x2d70,0xd2));var _0x02d7=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2d70[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x02d7('0x0'));var moment=require('moment');var Redis=require(_0x02d7('0x1'));var db=require(_0x02d7('0x2'))['db'];var config=require(_0x02d7('0x3'));config['redis']=_[_0x02d7('0x4')](config[_0x02d7('0x5')],{'host':_0x02d7('0x6'),'port':0x18eb});var io=require(_0x02d7('0x7'))(new Redis(config[_0x02d7('0x5')]));function closeInteractions(){var _0x335140=0x0;var _0xb7ad71=[];return db[_0x02d7('0x8')][_0x02d7('0x9')]({'raw':!![],'attributes':['id',_0x02d7('0xa')],'where':{'id':0x1}})[_0x02d7('0xb')](function(_0x3fb1ff){_0x335140=_0x3fb1ff[_0x02d7('0xa')];if(_0x335140){return db['ChatInteraction'][_0x02d7('0xc')]({'raw':!![],'attributes':['id',_0x02d7('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x02d7('0xe')](_0x3fb1ff['chatTimeout'],_0x02d7('0xf'))}}});}else{return[];}})[_0x02d7('0xb')](function(_0x3fca43){_0xb7ad71=_0x3fca43;if(_0x335140){return db[_0x02d7('0x10')][_0x02d7('0x11')]({'closeReason':_0x02d7('0x12'),'disposition':_0x02d7('0x13'),'closed':!![],'closedAt':moment()[_0x02d7('0x14')](_0x02d7('0x15'))},{'where':{'id':_[_0x02d7('0x16')](_0xb7ad71||[],'id')}});}})[_0x02d7('0xb')](function(_0x3f181d){for(var _0x39193c=0x0;_0x39193c<_0xb7ad71[_0x02d7('0x17')];_0x39193c++){io['emit'](_0x02d7('0x18'),{'id':_0xb7ad71[_0x39193c]['id'],'closed':!![]});}})[_0x02d7('0x19')](function(_0x422023){console[_0x02d7('0x1a')](_0x422023);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0xe1bf=['../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','emit','chatInteraction:update','catch','error','start','moment'];(function(_0x1c63e1,_0x39c5b7){var _0x2110a4=function(_0x4a55dd){while(--_0x4a55dd){_0x1c63e1['push'](_0x1c63e1['shift']());}};_0x2110a4(++_0x39c5b7);}(_0xe1bf,0x67));var _0xfe1b=function(_0x3636c2,_0x5bd571){_0x3636c2=_0x3636c2-0x0;var _0x482dce=_0xe1bf[_0x3636c2];return _0x482dce;};'use strict';var _=require('lodash');var moment=require(_0xfe1b('0x0'));var Redis=require('ioredis');var db=require(_0xfe1b('0x1'))['db'];var config=require(_0xfe1b('0x2'));config[_0xfe1b('0x3')]=_[_0xfe1b('0x4')](config['redis'],{'host':_0xfe1b('0x5'),'port':0x18eb});var io=require(_0xfe1b('0x6'))(new Redis(config[_0xfe1b('0x3')]));function closeInteractions(){var _0x308663=0x0;var _0x481192=[];return db[_0xfe1b('0x7')][_0xfe1b('0x8')]({'raw':!![],'attributes':['id',_0xfe1b('0x9')],'where':{'id':0x1}})['then'](function(_0x140ebf){_0x308663=_0x140ebf[_0xfe1b('0x9')];if(_0x308663){return db[_0xfe1b('0xa')][_0xfe1b('0xb')]({'raw':!![],'attributes':['id',_0xfe1b('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x140ebf[_0xfe1b('0x9')],_0xfe1b('0xd'))}}});}else{return[];}})[_0xfe1b('0xe')](function(_0xa28356){_0x481192=_0xa28356;if(_0x308663){return db[_0xfe1b('0xa')][_0xfe1b('0xf')]({'closeReason':_0xfe1b('0x10'),'disposition':_0xfe1b('0x11'),'closed':!![],'closedAt':moment()[_0xfe1b('0x12')](_0xfe1b('0x13'))},{'where':{'id':_[_0xfe1b('0x14')](_0x481192||[],'id')}});}})[_0xfe1b('0xe')](function(_0x5270ea){for(var _0x232869=0x0;_0x232869<_0x481192['length'];_0x232869++){io[_0xfe1b('0x15')](_0xfe1b('0x16'),{'id':_0x481192[_0x232869]['id'],'closed':!![]});}})[_0xfe1b('0x17')](function(_0x1008d7){console[_0xfe1b('0x18')](_0x1008d7);});}exports[_0xfe1b('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file