Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / whatsappQueue / whatsappQueue.rpc.js
index 8c98033..710e86a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1178=['request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','WhatsappQueue','find','ShowWhatsappQueue','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x59192f,_0x296497){var _0x350ef0=function(_0x3d6db7){while(--_0x3d6db7){_0x59192f['push'](_0x59192f['shift']());}};_0x350ef0(++_0x296497);}(_0x1178,0x6b));var _0x8117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1178[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8117('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8117('0x2'))['db'];var utils=require(_0x8117('0x3'));var logger=require(_0x8117('0x4'))(_0x8117('0x5'));var config=require(_0x8117('0x6'));var jayson=require(_0x8117('0x7'));var client=jayson[_0x8117('0x8')][_0x8117('0x9')]({'port':0x232a});config['redis']=_[_0x8117('0xa')](config[_0x8117('0xb')],{'host':_0x8117('0xc'),'port':0x18eb});var socket=require(_0x8117('0xd'))(new Redis(config['redis']));require(_0x8117('0xe'))[_0x8117('0xf')](socket);function respondWithRpcPromise(_0x49b8d8,_0x5e10c8,_0x134170){return new BPromise(function(_0x3ad638,_0x108de7){return client[_0x8117('0x10')](_0x49b8d8,_0x134170)[_0x8117('0x11')](function(_0x5464ef){logger[_0x8117('0x12')](_0x8117('0x13'),_0x5e10c8,_0x8117('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5e10c8,_0x8117('0x14'),JSON[_0x8117('0x15')](_0x5464ef));if(_0x5464ef[_0x8117('0x16')]){if(_0x5464ef['error'][_0x8117('0x17')]===0x1f4){logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);return _0x108de7(_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);}logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);return _0x3ad638(_0x5464ef['error'][_0x8117('0x18')]);}else{logger[_0x8117('0x12')](_0x8117('0x13'),_0x5e10c8,_0x8117('0x14'));_0x3ad638(_0x5464ef[_0x8117('0x19')][_0x8117('0x18')]);}})[_0x8117('0x1a')](function(_0x438dc5){logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x438dc5);_0x108de7(_0x438dc5);});});}exports['GetWhatsappQueue']=function(_0x36182f){var _0x294063=this;return new Promise(function(_0x3c64de,_0x144583){return db['WhatsappQueue'][_0x8117('0x1b')]({'raw':_0x36182f[_0x8117('0x1c')]?_0x36182f[_0x8117('0x1c')][_0x8117('0x1d')]===undefined?!![]:![]:!![],'where':_0x36182f['options']?_0x36182f[_0x8117('0x1c')][_0x8117('0x1e')]||null:null,'attributes':_0x36182f[_0x8117('0x1c')]?_0x36182f['options'][_0x8117('0x1f')]||null:null,'limit':_0x36182f[_0x8117('0x1c')]?_0x36182f['options'][_0x8117('0x20')]||null:null,'include':_0x36182f['options']?_0x36182f[_0x8117('0x1c')][_0x8117('0x21')]?_[_0x8117('0x22')](_0x36182f[_0x8117('0x1c')][_0x8117('0x21')],function(_0x500757){return{'model':db[_0x500757[_0x8117('0x23')]],'as':_0x500757['as'],'attributes':_0x500757['attributes'],'include':_0x500757[_0x8117('0x21')]?_['map'](_0x500757[_0x8117('0x21')],function(_0x27f577){return{'model':db[_0x27f577[_0x8117('0x23')]],'as':_0x27f577['as'],'attributes':_0x27f577['attributes'],'include':_0x27f577['include']?_[_0x8117('0x22')](_0x27f577[_0x8117('0x21')],function(_0x4e6214){return{'model':db[_0x4e6214[_0x8117('0x23')]],'as':_0x4e6214['as'],'attributes':_0x4e6214[_0x8117('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34870f){logger[_0x8117('0x12')](_0x8117('0x24'),_0x36182f);logger['debug'](_0x8117('0x24'),_0x36182f,JSON[_0x8117('0x15')](_0x34870f));_0x3c64de(_0x34870f);})[_0x8117('0x1a')](function(_0x5889b3){logger[_0x8117('0x16')](_0x8117('0x24'),_0x5889b3['message'],_0x36182f);_0x144583(_0x294063['error'](0x1f4,_0x5889b3[_0x8117('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x36a8cf){var _0x508f9d=this;return new Promise(function(_0xba9d0,_0x98bddd){return db[_0x8117('0x25')][_0x8117('0x26')]({'raw':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')][_0x8117('0x1d')]===undefined?!![]:![]:!![],'where':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')]['where']||null:null,'attributes':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')][_0x8117('0x1f')]||null:null,'include':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')]['include']?_[_0x8117('0x22')](_0x36a8cf['options']['include'],function(_0x48337c){return{'model':db[_0x48337c[_0x8117('0x23')]],'as':_0x48337c['as'],'attributes':_0x48337c[_0x8117('0x1f')],'include':_0x48337c['include']?_[_0x8117('0x22')](_0x48337c[_0x8117('0x21')],function(_0x6269d){return{'model':db[_0x6269d[_0x8117('0x23')]],'as':_0x6269d['as'],'attributes':_0x6269d['attributes'],'include':_0x6269d[_0x8117('0x21')]?_['map'](_0x6269d[_0x8117('0x21')],function(_0x339fd9){return{'model':db[_0x339fd9[_0x8117('0x23')]],'as':_0x339fd9['as'],'attributes':_0x339fd9[_0x8117('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3df162){logger[_0x8117('0x12')](_0x8117('0x27'),_0x36a8cf);logger[_0x8117('0x28')](_0x8117('0x27'),_0x36a8cf,JSON[_0x8117('0x15')](_0x3df162));_0xba9d0(_0x3df162);})[_0x8117('0x1a')](function(_0x1de9ad){logger[_0x8117('0x16')]('ShowWhatsappQueue',_0x1de9ad['message'],_0x36a8cf);_0x98bddd(_0x508f9d[_0x8117('0x16')](0x1f4,_0x1de9ad[_0x8117('0x18')]));});});};
\ No newline at end of file
+var _0x9f52=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map','ShowWhatsappQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc5cb,_0x32f79a){var _0x339a14=function(_0xde92eb){while(--_0xde92eb){_0x1cc5cb['push'](_0x1cc5cb['shift']());}};_0x339a14(++_0x32f79a);}(_0x9f52,0xb3));var _0x29f5=function(_0x1c20cc,_0x2f6860){_0x1c20cc=_0x1c20cc-0x0;var _0x2ed490=_0x9f52[_0x1c20cc];return _0x2ed490;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var moment=require(_0x29f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x29f5('0x2'));var fs=require('fs');var Redis=require(_0x29f5('0x3'));var db=require(_0x29f5('0x4'))['db'];var utils=require(_0x29f5('0x5'));var logger=require('../../config/logger')(_0x29f5('0x6'));var config=require(_0x29f5('0x7'));var jayson=require(_0x29f5('0x8'));var client=jayson[_0x29f5('0x9')][_0x29f5('0xa')]({'port':0x232a});config[_0x29f5('0xb')]=_[_0x29f5('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29f5('0xb')]));require(_0x29f5('0xd'))[_0x29f5('0xe')](socket);function respondWithRpcPromise(_0x26200c,_0x1f00a2,_0x4db1b6){return new BPromise(function(_0x584cd8,_0x4b71dd){return client[_0x29f5('0xf')](_0x26200c,_0x4db1b6)[_0x29f5('0x10')](function(_0x305768){logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,'request\x20sent');logger[_0x29f5('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1f00a2,_0x29f5('0x14'),JSON[_0x29f5('0x15')](_0x305768));if(_0x305768[_0x29f5('0x16')]){if(_0x305768[_0x29f5('0x16')]['code']===0x1f4){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x4b71dd(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x584cd8(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}else{logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,_0x29f5('0x14'));_0x584cd8(_0x305768['result'][_0x29f5('0x17')]);}})[_0x29f5('0x18')](function(_0x2b3028){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x2b3028);_0x4b71dd(_0x2b3028);});});}exports[_0x29f5('0x19')]=function(_0x19d646){var _0x20c25c=this;return new Promise(function(_0x2e1b7c,_0x4d2caa){return db[_0x29f5('0x1a')][_0x29f5('0x1b')]({'raw':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1e')]||null:null,'attributes':_0x19d646['options']?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1f')]||null:null,'limit':_0x19d646[_0x29f5('0x1c')]?_0x19d646['options']['limit']||null:null,'include':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')]['include']?_['map'](_0x19d646['options'][_0x29f5('0x20')],function(_0x5b8a07){return{'model':db[_0x5b8a07['model']],'as':_0x5b8a07['as'],'attributes':_0x5b8a07['attributes'],'include':_0x5b8a07[_0x29f5('0x20')]?_['map'](_0x5b8a07['include'],function(_0x381836){return{'model':db[_0x381836[_0x29f5('0x21')]],'as':_0x381836['as'],'attributes':_0x381836[_0x29f5('0x1f')],'include':_0x381836['include']?_[_0x29f5('0x22')](_0x381836[_0x29f5('0x20')],function(_0x532330){return{'model':db[_0x532330['model']],'as':_0x532330['as'],'attributes':_0x532330['attributes']};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x2beb11){logger[_0x29f5('0x11')](_0x29f5('0x19'),_0x19d646);logger[_0x29f5('0x13')](_0x29f5('0x19'),_0x19d646,JSON[_0x29f5('0x15')](_0x2beb11));_0x2e1b7c(_0x2beb11);})[_0x29f5('0x18')](function(_0x21a570){logger[_0x29f5('0x16')](_0x29f5('0x19'),_0x21a570[_0x29f5('0x17')],_0x19d646);_0x4d2caa(_0x20c25c[_0x29f5('0x16')](0x1f4,_0x21a570[_0x29f5('0x17')]));});});};exports[_0x29f5('0x23')]=function(_0x1be222){var _0x2ebeb3=this;return new Promise(function(_0x4aef8e,_0x223b76){return db[_0x29f5('0x1a')][_0x29f5('0x24')]({'raw':_0x1be222[_0x29f5('0x1c')]?_0x1be222['options'][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['where']||null:null,'attributes':_0x1be222['options']?_0x1be222['options'][_0x29f5('0x1f')]||null:null,'include':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['include']?_['map'](_0x1be222['options']['include'],function(_0x169d22){return{'model':db[_0x169d22[_0x29f5('0x21')]],'as':_0x169d22['as'],'attributes':_0x169d22['attributes'],'include':_0x169d22['include']?_[_0x29f5('0x22')](_0x169d22['include'],function(_0x3b26b1){return{'model':db[_0x3b26b1[_0x29f5('0x21')]],'as':_0x3b26b1['as'],'attributes':_0x3b26b1[_0x29f5('0x1f')],'include':_0x3b26b1[_0x29f5('0x20')]?_[_0x29f5('0x22')](_0x3b26b1[_0x29f5('0x20')],function(_0x5f2b58){return{'model':db[_0x5f2b58[_0x29f5('0x21')]],'as':_0x5f2b58['as'],'attributes':_0x5f2b58[_0x29f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x4b161d){logger[_0x29f5('0x11')](_0x29f5('0x23'),_0x1be222);logger[_0x29f5('0x13')]('ShowWhatsappQueue',_0x1be222,JSON[_0x29f5('0x15')](_0x4b161d));_0x4aef8e(_0x4b161d);})['catch'](function(_0x1b5c4c){logger[_0x29f5('0x16')]('ShowWhatsappQueue',_0x1b5c4c['message'],_0x1be222);_0x223b76(_0x2ebeb3[_0x29f5('0x16')](0x1f4,_0x1b5c4c[_0x29f5('0x17')]));});});};
\ No newline at end of file