Built motion from commit dc14b02d.|2.6.27
[motion2.git] / server / api / whatsappQueue / whatsappQueue.rpc.js
index c745800..e012aa9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2358=['code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','then','stringify','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ee4d0,_0x3abf3c){var _0x442b77=function(_0x53c2d4){while(--_0x53c2d4){_0x1ee4d0['push'](_0x1ee4d0['shift']());}};_0x442b77(++_0x3abf3c);}(_0x2358,0x12b));var _0x8235=function(_0x2765e7,_0x11e5cf){_0x2765e7=_0x2765e7-0x0;var _0x331d93=_0x2358[_0x2765e7];return _0x331d93;};'use strict';var _=require(_0x8235('0x0'));var util=require(_0x8235('0x1'));var moment=require(_0x8235('0x2'));var BPromise=require(_0x8235('0x3'));var rs=require(_0x8235('0x4'));var fs=require('fs');var Redis=require(_0x8235('0x5'));var db=require(_0x8235('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8235('0x7'));var config=require(_0x8235('0x8'));var jayson=require(_0x8235('0x9'));var client=jayson[_0x8235('0xa')][_0x8235('0xb')]({'port':0x232a});config[_0x8235('0xc')]=_['defaults'](config[_0x8235('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8235('0xd'))(new Redis(config[_0x8235('0xc')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5009a7,_0x20e5d6,_0x1abd19){return new BPromise(function(_0x5a8621,_0x388384){return client[_0x8235('0xe')](_0x5009a7,_0x1abd19)['then'](function(_0x151693){logger[_0x8235('0xf')](_0x8235('0x10'),_0x20e5d6,_0x8235('0x11'));logger[_0x8235('0x12')](_0x8235('0x13'),_0x20e5d6,_0x8235('0x11'),JSON['stringify'](_0x151693));if(_0x151693['error']){if(_0x151693[_0x8235('0x14')][_0x8235('0x15')]===0x1f4){logger[_0x8235('0x14')](_0x8235('0x10'),_0x20e5d6,_0x151693[_0x8235('0x14')]['message']);return _0x388384(_0x151693[_0x8235('0x14')][_0x8235('0x16')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x20e5d6,_0x151693[_0x8235('0x14')]['message']);return _0x5a8621(_0x151693[_0x8235('0x14')][_0x8235('0x16')]);}else{logger[_0x8235('0xf')](_0x8235('0x10'),_0x20e5d6,_0x8235('0x11'));_0x5a8621(_0x151693[_0x8235('0x17')]['message']);}})[_0x8235('0x18')](function(_0x445bfd){logger[_0x8235('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x20e5d6,_0x445bfd);_0x388384(_0x445bfd);});});}exports[_0x8235('0x19')]=function(_0x110dce){var _0x41d454=this;return new Promise(function(_0x329b87,_0xcd79ea){return db[_0x8235('0x1a')][_0x8235('0x1b')]({'raw':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x1d')]===undefined?!![]:![]:!![],'where':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')]['where']||null:null,'attributes':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x1e')]||null:null,'limit':_0x110dce[_0x8235('0x1c')]?_0x110dce['options'][_0x8235('0x1f')]||null:null,'include':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x20')]?_[_0x8235('0x21')](_0x110dce['options'][_0x8235('0x20')],function(_0x767ff5){return{'model':db[_0x767ff5['model']],'as':_0x767ff5['as'],'attributes':_0x767ff5[_0x8235('0x1e')],'include':_0x767ff5['include']?_['map'](_0x767ff5[_0x8235('0x20')],function(_0x4a055e){return{'model':db[_0x4a055e[_0x8235('0x22')]],'as':_0x4a055e['as'],'attributes':_0x4a055e['attributes'],'include':_0x4a055e[_0x8235('0x20')]?_[_0x8235('0x21')](_0x4a055e[_0x8235('0x20')],function(_0xa59c38){return{'model':db[_0xa59c38[_0x8235('0x22')]],'as':_0xa59c38['as'],'attributes':_0xa59c38[_0x8235('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8235('0x23')](function(_0x5c3048){logger['info'](_0x8235('0x19'),_0x110dce);logger[_0x8235('0x12')](_0x8235('0x19'),_0x110dce,JSON[_0x8235('0x24')](_0x5c3048));_0x329b87(_0x5c3048);})[_0x8235('0x18')](function(_0x2d2309){logger[_0x8235('0x14')]('GetWhatsappQueue',_0x2d2309[_0x8235('0x16')],_0x110dce);_0xcd79ea(_0x41d454[_0x8235('0x14')](0x1f4,_0x2d2309[_0x8235('0x16')]));});});};exports[_0x8235('0x25')]=function(_0x5843f1){var _0x37c7d6=this;return new Promise(function(_0x1f0196,_0x14e85a){return db['WhatsappQueue'][_0x8235('0x26')]({'raw':_0x5843f1[_0x8235('0x1c')]?_0x5843f1['options'][_0x8235('0x1d')]===undefined?!![]:![]:!![],'where':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')][_0x8235('0x27')]||null:null,'attributes':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')][_0x8235('0x1e')]||null:null,'include':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')]['include']?_[_0x8235('0x21')](_0x5843f1[_0x8235('0x1c')][_0x8235('0x20')],function(_0x2da2d3){return{'model':db[_0x2da2d3[_0x8235('0x22')]],'as':_0x2da2d3['as'],'attributes':_0x2da2d3['attributes'],'include':_0x2da2d3[_0x8235('0x20')]?_[_0x8235('0x21')](_0x2da2d3['include'],function(_0x491e36){return{'model':db[_0x491e36['model']],'as':_0x491e36['as'],'attributes':_0x491e36[_0x8235('0x1e')],'include':_0x491e36['include']?_[_0x8235('0x21')](_0x491e36['include'],function(_0x5154d3){return{'model':db[_0x5154d3['model']],'as':_0x5154d3['as'],'attributes':_0x5154d3[_0x8235('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56263f){logger[_0x8235('0xf')](_0x8235('0x25'),_0x5843f1);logger[_0x8235('0x12')]('ShowWhatsappQueue',_0x5843f1,JSON[_0x8235('0x24')](_0x56263f));_0x1f0196(_0x56263f);})['catch'](function(_0x462188){logger[_0x8235('0x14')]('ShowWhatsappQueue',_0x462188['message'],_0x5843f1);_0x14e85a(_0x37c7d6['error'](0x1f4,_0x462188[_0x8235('0x16')]));});});};
\ No newline at end of file
+var _0x014a=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x157064,_0x2b3e35){var _0x595813=function(_0x3cc43c){while(--_0x3cc43c){_0x157064['push'](_0x157064['shift']());}};_0x595813(++_0x2b3e35);}(_0x014a,0x1a4));var _0xa014=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x014a[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0xa014('0x0'));var moment=require(_0xa014('0x1'));var BPromise=require(_0xa014('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa014('0x3'));var db=require(_0xa014('0x4'))['db'];var utils=require(_0xa014('0x5'));var logger=require(_0xa014('0x6'))(_0xa014('0x7'));var config=require(_0xa014('0x8'));var jayson=require(_0xa014('0x9'));var client=jayson[_0xa014('0xa')][_0xa014('0xb')]({'port':0x232a});config[_0xa014('0xc')]=_[_0xa014('0xd')](config['redis'],{'host':_0xa014('0xe'),'port':0x18eb});var socket=require(_0xa014('0xf'))(new Redis(config[_0xa014('0xc')]));require(_0xa014('0x10'))[_0xa014('0x11')](socket);function respondWithRpcPromise(_0x24fea3,_0xb6f747,_0x5dafcb){return new BPromise(function(_0x34aa58,_0x4be8af){return client[_0xa014('0x12')](_0x24fea3,_0x5dafcb)[_0xa014('0x13')](function(_0x17fa4c){logger['info'](_0xa014('0x14'),_0xb6f747,'request\x20sent');logger['debug'](_0xa014('0x15'),_0xb6f747,'request\x20sent',JSON[_0xa014('0x16')](_0x17fa4c));if(_0x17fa4c[_0xa014('0x17')]){if(_0x17fa4c[_0xa014('0x17')][_0xa014('0x18')]===0x1f4){logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);return _0x4be8af(_0x17fa4c[_0xa014('0x17')]['message']);}logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);return _0x34aa58(_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);}else{logger[_0xa014('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0xb6f747,_0xa014('0x1b'));_0x34aa58(_0x17fa4c[_0xa014('0x1c')][_0xa014('0x19')]);}})[_0xa014('0x1d')](function(_0x3c261b){logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x3c261b);_0x4be8af(_0x3c261b);});});}exports['GetWhatsappQueue']=function(_0x267e11){var _0x4ac5e0=this;return new Promise(function(_0x99a71b,_0x445924){return db[_0xa014('0x1e')][_0xa014('0x1f')]({'raw':_0x267e11[_0xa014('0x20')]?_0x267e11[_0xa014('0x20')][_0xa014('0x21')]===undefined?!![]:![]:!![],'where':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x22')]||null:null,'attributes':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x23')]||null:null,'limit':_0x267e11[_0xa014('0x20')]?_0x267e11[_0xa014('0x20')][_0xa014('0x24')]||null:null,'include':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x25')]?_[_0xa014('0x26')](_0x267e11[_0xa014('0x20')][_0xa014('0x25')],function(_0x4ef02c){return{'model':db[_0x4ef02c[_0xa014('0x27')]],'as':_0x4ef02c['as'],'attributes':_0x4ef02c[_0xa014('0x23')],'include':_0x4ef02c[_0xa014('0x25')]?_[_0xa014('0x26')](_0x4ef02c[_0xa014('0x25')],function(_0x4dc7cb){return{'model':db[_0x4dc7cb[_0xa014('0x27')]],'as':_0x4dc7cb['as'],'attributes':_0x4dc7cb[_0xa014('0x23')],'include':_0x4dc7cb[_0xa014('0x25')]?_[_0xa014('0x26')](_0x4dc7cb['include'],function(_0x330975){return{'model':db[_0x330975[_0xa014('0x27')]],'as':_0x330975['as'],'attributes':_0x330975[_0xa014('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa014('0x13')](function(_0xa23c96){logger[_0xa014('0x1a')]('GetWhatsappQueue',_0x267e11);logger['debug'](_0xa014('0x28'),_0x267e11,JSON['stringify'](_0xa23c96));_0x99a71b(_0xa23c96);})['catch'](function(_0x4cbe94){logger[_0xa014('0x17')](_0xa014('0x28'),_0x4cbe94[_0xa014('0x19')],_0x267e11);_0x445924(_0x4ac5e0['error'](0x1f4,_0x4cbe94['message']));});});};exports['ShowWhatsappQueue']=function(_0x308993){var _0x466a30=this;return new Promise(function(_0xb87adc,_0x5c5b44){return db['WhatsappQueue'][_0xa014('0x29')]({'raw':_0x308993['options']?_0x308993[_0xa014('0x20')][_0xa014('0x21')]===undefined?!![]:![]:!![],'where':_0x308993[_0xa014('0x20')]?_0x308993[_0xa014('0x20')]['where']||null:null,'attributes':_0x308993[_0xa014('0x20')]?_0x308993['options']['attributes']||null:null,'include':_0x308993[_0xa014('0x20')]?_0x308993[_0xa014('0x20')][_0xa014('0x25')]?_[_0xa014('0x26')](_0x308993[_0xa014('0x20')][_0xa014('0x25')],function(_0x45b6fb){return{'model':db[_0x45b6fb[_0xa014('0x27')]],'as':_0x45b6fb['as'],'attributes':_0x45b6fb[_0xa014('0x23')],'include':_0x45b6fb[_0xa014('0x25')]?_['map'](_0x45b6fb['include'],function(_0x52ffe6){return{'model':db[_0x52ffe6[_0xa014('0x27')]],'as':_0x52ffe6['as'],'attributes':_0x52ffe6[_0xa014('0x23')],'include':_0x52ffe6['include']?_['map'](_0x52ffe6[_0xa014('0x25')],function(_0xe3901e){return{'model':db[_0xe3901e[_0xa014('0x27')]],'as':_0xe3901e['as'],'attributes':_0xe3901e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f7ede){logger['info'](_0xa014('0x2a'),_0x308993);logger['debug'](_0xa014('0x2a'),_0x308993,JSON['stringify'](_0x3f7ede));_0xb87adc(_0x3f7ede);})[_0xa014('0x1d')](function(_0x59580d){logger[_0xa014('0x17')](_0xa014('0x2a'),_0x59580d[_0xa014('0x19')],_0x308993);_0x5c5b44(_0x466a30[_0xa014('0x17')](0x1f4,_0x59580d[_0xa014('0x19')]));});});};
\ No newline at end of file