Built motion from commit 43538d75.|2.5.35
[motion2.git] / server / api / whatsappQueue / whatsappQueue.rpc.js
index 215f66f..b78af21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb08=['options','where','attributes','limit','include','map','model','then','find','ShowWhatsappQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','findAll','raw'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbb08,0xe7));var _0x8bb0=function(_0x33fd3f,_0x34ac9e){_0x33fd3f=_0x33fd3f-0x0;var _0x15c64a=_0xbb08[_0x33fd3f];return _0x15c64a;};'use strict';var _=require(_0x8bb0('0x0'));var util=require(_0x8bb0('0x1'));var moment=require(_0x8bb0('0x2'));var BPromise=require(_0x8bb0('0x3'));var rs=require(_0x8bb0('0x4'));var fs=require('fs');var Redis=require(_0x8bb0('0x5'));var db=require(_0x8bb0('0x6'))['db'];var utils=require(_0x8bb0('0x7'));var logger=require(_0x8bb0('0x8'))(_0x8bb0('0x9'));var config=require(_0x8bb0('0xa'));var jayson=require(_0x8bb0('0xb'));var client=jayson[_0x8bb0('0xc')][_0x8bb0('0xd')]({'port':0x232a});config[_0x8bb0('0xe')]=_[_0x8bb0('0xf')](config[_0x8bb0('0xe')],{'host':_0x8bb0('0x10'),'port':0x18eb});var socket=require(_0x8bb0('0x11'))(new Redis(config[_0x8bb0('0xe')]));require(_0x8bb0('0x12'))[_0x8bb0('0x13')](socket);function respondWithRpcPromise(_0x4fae6f,_0x539a8d,_0x48b81e){return new BPromise(function(_0x2309e4,_0x500019){return client['request'](_0x4fae6f,_0x48b81e)['then'](function(_0x4ebcea){logger[_0x8bb0('0x14')](_0x8bb0('0x15'),_0x539a8d,_0x8bb0('0x16'));logger[_0x8bb0('0x17')](_0x8bb0('0x18'),_0x539a8d,_0x8bb0('0x16'),JSON[_0x8bb0('0x19')](_0x4ebcea));if(_0x4ebcea[_0x8bb0('0x1a')]){if(_0x4ebcea['error'][_0x8bb0('0x1b')]===0x1f4){logger[_0x8bb0('0x1a')](_0x8bb0('0x15'),_0x539a8d,_0x4ebcea[_0x8bb0('0x1a')][_0x8bb0('0x1c')]);return _0x500019(_0x4ebcea[_0x8bb0('0x1a')][_0x8bb0('0x1c')]);}logger[_0x8bb0('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x539a8d,_0x4ebcea['error'][_0x8bb0('0x1c')]);return _0x2309e4(_0x4ebcea[_0x8bb0('0x1a')]['message']);}else{logger[_0x8bb0('0x14')](_0x8bb0('0x15'),_0x539a8d,_0x8bb0('0x16'));_0x2309e4(_0x4ebcea['result'][_0x8bb0('0x1c')]);}})['catch'](function(_0x55a14e){logger[_0x8bb0('0x1a')](_0x8bb0('0x15'),_0x539a8d,_0x55a14e);_0x500019(_0x55a14e);});});}exports[_0x8bb0('0x1d')]=function(_0x24aced){var _0x20a8ad=this;return new Promise(function(_0x36bede,_0x421770){return db[_0x8bb0('0x1e')][_0x8bb0('0x1f')]({'raw':_0x24aced['options']?_0x24aced['options'][_0x8bb0('0x20')]===undefined?!![]:![]:!![],'where':_0x24aced[_0x8bb0('0x21')]?_0x24aced[_0x8bb0('0x21')][_0x8bb0('0x22')]||null:null,'attributes':_0x24aced['options']?_0x24aced[_0x8bb0('0x21')][_0x8bb0('0x23')]||null:null,'limit':_0x24aced['options']?_0x24aced[_0x8bb0('0x21')][_0x8bb0('0x24')]||null:null,'include':_0x24aced[_0x8bb0('0x21')]?_0x24aced[_0x8bb0('0x21')][_0x8bb0('0x25')]?_[_0x8bb0('0x26')](_0x24aced[_0x8bb0('0x21')][_0x8bb0('0x25')],function(_0x50a632){return{'model':db[_0x50a632[_0x8bb0('0x27')]],'as':_0x50a632['as'],'attributes':_0x50a632[_0x8bb0('0x23')],'include':_0x50a632['include']?_[_0x8bb0('0x26')](_0x50a632['include'],function(_0x41b45b){return{'model':db[_0x41b45b[_0x8bb0('0x27')]],'as':_0x41b45b['as'],'attributes':_0x41b45b[_0x8bb0('0x23')],'include':_0x41b45b[_0x8bb0('0x25')]?_['map'](_0x41b45b['include'],function(_0x5b17dd){return{'model':db[_0x5b17dd['model']],'as':_0x5b17dd['as'],'attributes':_0x5b17dd[_0x8bb0('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8bb0('0x28')](function(_0xbba5f){logger[_0x8bb0('0x14')](_0x8bb0('0x1d'),_0x24aced);logger[_0x8bb0('0x17')](_0x8bb0('0x1d'),_0x24aced,JSON[_0x8bb0('0x19')](_0xbba5f));_0x36bede(_0xbba5f);})['catch'](function(_0x2ed48c){logger[_0x8bb0('0x1a')](_0x8bb0('0x1d'),_0x2ed48c[_0x8bb0('0x1c')],_0x24aced);_0x421770(_0x20a8ad[_0x8bb0('0x1a')](0x1f4,_0x2ed48c[_0x8bb0('0x1c')]));});});};exports['ShowWhatsappQueue']=function(_0x115b5f){var _0x5a9d83=this;return new Promise(function(_0x40d78f,_0xbe46ea){return db['WhatsappQueue'][_0x8bb0('0x29')]({'raw':_0x115b5f[_0x8bb0('0x21')]?_0x115b5f[_0x8bb0('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x115b5f['options']?_0x115b5f[_0x8bb0('0x21')][_0x8bb0('0x22')]||null:null,'attributes':_0x115b5f[_0x8bb0('0x21')]?_0x115b5f['options'][_0x8bb0('0x23')]||null:null,'include':_0x115b5f[_0x8bb0('0x21')]?_0x115b5f['options'][_0x8bb0('0x25')]?_[_0x8bb0('0x26')](_0x115b5f[_0x8bb0('0x21')][_0x8bb0('0x25')],function(_0x12f7d6){return{'model':db[_0x12f7d6[_0x8bb0('0x27')]],'as':_0x12f7d6['as'],'attributes':_0x12f7d6[_0x8bb0('0x23')],'include':_0x12f7d6[_0x8bb0('0x25')]?_[_0x8bb0('0x26')](_0x12f7d6[_0x8bb0('0x25')],function(_0xe980ff){return{'model':db[_0xe980ff[_0x8bb0('0x27')]],'as':_0xe980ff['as'],'attributes':_0xe980ff['attributes'],'include':_0xe980ff[_0x8bb0('0x25')]?_[_0x8bb0('0x26')](_0xe980ff[_0x8bb0('0x25')],function(_0x35a37d){return{'model':db[_0x35a37d[_0x8bb0('0x27')]],'as':_0x35a37d['as'],'attributes':_0x35a37d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bb0('0x28')](function(_0x200117){logger[_0x8bb0('0x14')](_0x8bb0('0x2a'),_0x115b5f);logger[_0x8bb0('0x17')]('ShowWhatsappQueue',_0x115b5f,JSON[_0x8bb0('0x19')](_0x200117));_0x40d78f(_0x200117);})[_0x8bb0('0x2b')](function(_0x4e60eb){logger[_0x8bb0('0x1a')]('ShowWhatsappQueue',_0x4e60eb[_0x8bb0('0x1c')],_0x115b5f);_0xbe46ea(_0x5a9d83['error'](0x1f4,_0x4e60eb['message']));});});};
\ No newline at end of file
+var _0x0a49=['map','include','model','attributes','then','ShowWhatsappQueue','stringify','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit'];(function(_0x5a3852,_0xf350d){var _0xcb15fb=function(_0x575e7a){while(--_0x575e7a){_0x5a3852['push'](_0x5a3852['shift']());}};_0xcb15fb(++_0xf350d);}(_0x0a49,0xc0));var _0x90a4=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x0a49[_0xb833b1];return _0x1ab87a;};'use strict';var _=require(_0x90a4('0x0'));var util=require('util');var moment=require(_0x90a4('0x1'));var BPromise=require('bluebird');var rs=require(_0x90a4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90a4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x90a4('0x4'))(_0x90a4('0x5'));var config=require(_0x90a4('0x6'));var jayson=require(_0x90a4('0x7'));var client=jayson[_0x90a4('0x8')][_0x90a4('0x9')]({'port':0x232a});config[_0x90a4('0xa')]=_[_0x90a4('0xb')](config[_0x90a4('0xa')],{'host':_0x90a4('0xc'),'port':0x18eb});var socket=require(_0x90a4('0xd'))(new Redis(config[_0x90a4('0xa')]));require('./whatsappQueue.socket')[_0x90a4('0xe')](socket);function respondWithRpcPromise(_0x1366cb,_0x41f583,_0x53a7df){return new BPromise(function(_0x24a495,_0x3b71dd){return client['request'](_0x1366cb,_0x53a7df)['then'](function(_0x35d7be){logger[_0x90a4('0xf')](_0x90a4('0x10'),_0x41f583,'request\x20sent');logger[_0x90a4('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x41f583,'request\x20sent',JSON['stringify'](_0x35d7be));if(_0x35d7be[_0x90a4('0x12')]){if(_0x35d7be[_0x90a4('0x12')][_0x90a4('0x13')]===0x1f4){logger['error'](_0x90a4('0x10'),_0x41f583,_0x35d7be['error'][_0x90a4('0x14')]);return _0x3b71dd(_0x35d7be[_0x90a4('0x12')][_0x90a4('0x14')]);}logger[_0x90a4('0x12')](_0x90a4('0x10'),_0x41f583,_0x35d7be[_0x90a4('0x12')][_0x90a4('0x14')]);return _0x24a495(_0x35d7be[_0x90a4('0x12')]['message']);}else{logger[_0x90a4('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x41f583,_0x90a4('0x15'));_0x24a495(_0x35d7be[_0x90a4('0x16')][_0x90a4('0x14')]);}})[_0x90a4('0x17')](function(_0x5c0fe6){logger[_0x90a4('0x12')](_0x90a4('0x10'),_0x41f583,_0x5c0fe6);_0x3b71dd(_0x5c0fe6);});});}exports[_0x90a4('0x18')]=function(_0x55d487){var _0x26fefe=this;return new Promise(function(_0x770de0,_0x4cddc2){return db[_0x90a4('0x19')]['findAll']({'raw':_0x55d487[_0x90a4('0x1a')]?_0x55d487[_0x90a4('0x1a')][_0x90a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x55d487['options']?_0x55d487[_0x90a4('0x1a')][_0x90a4('0x1c')]||null:null,'attributes':_0x55d487[_0x90a4('0x1a')]?_0x55d487['options']['attributes']||null:null,'limit':_0x55d487[_0x90a4('0x1a')]?_0x55d487[_0x90a4('0x1a')][_0x90a4('0x1d')]||null:null,'include':_0x55d487['options']?_0x55d487['options']['include']?_[_0x90a4('0x1e')](_0x55d487[_0x90a4('0x1a')][_0x90a4('0x1f')],function(_0x20d51d){return{'model':db[_0x20d51d[_0x90a4('0x20')]],'as':_0x20d51d['as'],'attributes':_0x20d51d[_0x90a4('0x21')],'include':_0x20d51d[_0x90a4('0x1f')]?_[_0x90a4('0x1e')](_0x20d51d[_0x90a4('0x1f')],function(_0x4c2557){return{'model':db[_0x4c2557[_0x90a4('0x20')]],'as':_0x4c2557['as'],'attributes':_0x4c2557[_0x90a4('0x21')],'include':_0x4c2557[_0x90a4('0x1f')]?_[_0x90a4('0x1e')](_0x4c2557[_0x90a4('0x1f')],function(_0x1bb1a1){return{'model':db[_0x1bb1a1[_0x90a4('0x20')]],'as':_0x1bb1a1['as'],'attributes':_0x1bb1a1[_0x90a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x90a4('0x22')](function(_0x2756a2){logger[_0x90a4('0xf')](_0x90a4('0x18'),_0x55d487);logger[_0x90a4('0x11')](_0x90a4('0x18'),_0x55d487,JSON['stringify'](_0x2756a2));_0x770de0(_0x2756a2);})['catch'](function(_0x3ee35b){logger['error'](_0x90a4('0x18'),_0x3ee35b[_0x90a4('0x14')],_0x55d487);_0x4cddc2(_0x26fefe['error'](0x1f4,_0x3ee35b[_0x90a4('0x14')]));});});};exports[_0x90a4('0x23')]=function(_0x56ed15){var _0x357b59=this;return new Promise(function(_0x199d74,_0x242c82){return db[_0x90a4('0x19')]['find']({'raw':_0x56ed15[_0x90a4('0x1a')]?_0x56ed15[_0x90a4('0x1a')][_0x90a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x56ed15[_0x90a4('0x1a')]?_0x56ed15['options'][_0x90a4('0x1c')]||null:null,'attributes':_0x56ed15[_0x90a4('0x1a')]?_0x56ed15['options']['attributes']||null:null,'include':_0x56ed15['options']?_0x56ed15[_0x90a4('0x1a')][_0x90a4('0x1f')]?_[_0x90a4('0x1e')](_0x56ed15[_0x90a4('0x1a')][_0x90a4('0x1f')],function(_0x1ded09){return{'model':db[_0x1ded09[_0x90a4('0x20')]],'as':_0x1ded09['as'],'attributes':_0x1ded09[_0x90a4('0x21')],'include':_0x1ded09[_0x90a4('0x1f')]?_[_0x90a4('0x1e')](_0x1ded09[_0x90a4('0x1f')],function(_0x3c2b58){return{'model':db[_0x3c2b58[_0x90a4('0x20')]],'as':_0x3c2b58['as'],'attributes':_0x3c2b58[_0x90a4('0x21')],'include':_0x3c2b58[_0x90a4('0x1f')]?_[_0x90a4('0x1e')](_0x3c2b58[_0x90a4('0x1f')],function(_0x5566b0){return{'model':db[_0x5566b0[_0x90a4('0x20')]],'as':_0x5566b0['as'],'attributes':_0x5566b0[_0x90a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x90a4('0x22')](function(_0x535c49){logger[_0x90a4('0xf')](_0x90a4('0x23'),_0x56ed15);logger[_0x90a4('0x11')](_0x90a4('0x23'),_0x56ed15,JSON[_0x90a4('0x24')](_0x535c49));_0x199d74(_0x535c49);})[_0x90a4('0x17')](function(_0x536c77){logger['error'](_0x90a4('0x23'),_0x536c77['message'],_0x56ed15);_0x242c82(_0x357b59[_0x90a4('0x12')](0x1f4,_0x536c77[_0x90a4('0x14')]));});});};
\ No newline at end of file