Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / whatsappAccount / whatsappAccount.rpc.js
index 0c0e044..9a30a7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c85=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','moment'];(function(_0xa13070,_0x50d519){var _0x3d0506=function(_0x2d2d53){while(--_0x2d2d53){_0xa13070['push'](_0xa13070['shift']());}};_0x3d0506(++_0x50d519);}(_0x4c85,0x1df));var _0x54c8=function(_0x2f6378,_0xc5b3c6){_0x2f6378=_0x2f6378-0x0;var _0x50eb1d=_0x4c85[_0x2f6378];return _0x50eb1d;};'use strict';var _=require('lodash');var util=require(_0x54c8('0x0'));var moment=require(_0x54c8('0x1'));var BPromise=require(_0x54c8('0x2'));var rs=require(_0x54c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54c8('0x4'))['db'];var utils=require(_0x54c8('0x5'));var logger=require(_0x54c8('0x6'))(_0x54c8('0x7'));var config=require(_0x54c8('0x8'));var jayson=require(_0x54c8('0x9'));var client=jayson[_0x54c8('0xa')][_0x54c8('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x54c8('0xc')],{'host':_0x54c8('0xd'),'port':0x18eb});var socket=require(_0x54c8('0xe'))(new Redis(config[_0x54c8('0xc')]));require(_0x54c8('0xf'))['register'](socket);function respondWithRpcPromise(_0x542fe2,_0x8da677,_0x3ed4b9){return new BPromise(function(_0x14a935,_0x506821){return client[_0x54c8('0x10')](_0x542fe2,_0x3ed4b9)[_0x54c8('0x11')](function(_0x5d4a7d){logger[_0x54c8('0x12')](_0x54c8('0x13'),_0x8da677,_0x54c8('0x14'));logger[_0x54c8('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8da677,_0x54c8('0x14'),JSON[_0x54c8('0x16')](_0x5d4a7d));if(_0x5d4a7d['error']){if(_0x5d4a7d[_0x54c8('0x17')][_0x54c8('0x18')]===0x1f4){logger[_0x54c8('0x17')](_0x54c8('0x13'),_0x8da677,_0x5d4a7d['error'][_0x54c8('0x19')]);return _0x506821(_0x5d4a7d[_0x54c8('0x17')]['message']);}logger[_0x54c8('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x8da677,_0x5d4a7d[_0x54c8('0x17')][_0x54c8('0x19')]);return _0x14a935(_0x5d4a7d['error'][_0x54c8('0x19')]);}else{logger[_0x54c8('0x12')](_0x54c8('0x13'),_0x8da677,'request\x20sent');_0x14a935(_0x5d4a7d[_0x54c8('0x1a')]['message']);}})[_0x54c8('0x1b')](function(_0x49bb47){logger[_0x54c8('0x17')](_0x54c8('0x13'),_0x8da677,_0x49bb47);_0x506821(_0x49bb47);});});}exports[_0x54c8('0x1c')]=function(_0x38d77c){var _0x824398=this;return new Promise(function(_0x335178,_0x502e7b){return db[_0x54c8('0x1d')]['find']({'raw':_0x38d77c['options']?_0x38d77c[_0x54c8('0x1e')][_0x54c8('0x1f')]===undefined?!![]:![]:!![],'where':_0x38d77c[_0x54c8('0x1e')]?_0x38d77c[_0x54c8('0x1e')][_0x54c8('0x20')]||null:null,'attributes':_0x38d77c[_0x54c8('0x1e')]?_0x38d77c[_0x54c8('0x1e')][_0x54c8('0x21')]||null:null,'include':_0x38d77c[_0x54c8('0x1e')]?_0x38d77c[_0x54c8('0x1e')][_0x54c8('0x22')]?_[_0x54c8('0x23')](_0x38d77c[_0x54c8('0x1e')][_0x54c8('0x22')],function(_0x736c82){return{'model':db[_0x736c82[_0x54c8('0x24')]],'as':_0x736c82['as'],'attributes':_0x736c82[_0x54c8('0x21')],'include':_0x736c82[_0x54c8('0x22')]?_[_0x54c8('0x23')](_0x736c82['include'],function(_0x5bda7e){return{'model':db[_0x5bda7e[_0x54c8('0x24')]],'as':_0x5bda7e['as'],'attributes':_0x5bda7e[_0x54c8('0x21')],'include':_0x5bda7e[_0x54c8('0x22')]?_[_0x54c8('0x23')](_0x5bda7e[_0x54c8('0x22')],function(_0x515144){return{'model':db[_0x515144['model']],'as':_0x515144['as'],'attributes':_0x515144[_0x54c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x54c8('0x11')](function(_0x3df9f6){logger[_0x54c8('0x12')](_0x54c8('0x1c'),_0x38d77c);logger[_0x54c8('0x15')](_0x54c8('0x1c'),_0x38d77c,JSON[_0x54c8('0x16')](_0x3df9f6));_0x335178(_0x3df9f6);})[_0x54c8('0x1b')](function(_0xae0942){logger['error'](_0x54c8('0x1c'),_0xae0942[_0x54c8('0x19')],_0x38d77c);_0x502e7b(_0x824398[_0x54c8('0x17')](0x1f4,_0xae0942[_0x54c8('0x19')]));});});};
\ No newline at end of file
+var _0x5e02=['attributes','include','map','model','then','debug','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','where'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5e02,0x1c7));var _0x25e0=function(_0x4d9205,_0x8e02b2){_0x4d9205=_0x4d9205-0x0;var _0x2d6e01=_0x5e02[_0x4d9205];return _0x2d6e01;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25e0('0x1'));var fs=require('fs');var Redis=require(_0x25e0('0x2'));var db=require(_0x25e0('0x3'))['db'];var utils=require(_0x25e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25e0('0x5'));var jayson=require(_0x25e0('0x6'));var client=jayson['client'][_0x25e0('0x7')]({'port':0x232a});config[_0x25e0('0x8')]=_[_0x25e0('0x9')](config[_0x25e0('0x8')],{'host':_0x25e0('0xa'),'port':0x18eb});var socket=require(_0x25e0('0xb'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x25e0('0xc')](socket);function respondWithRpcPromise(_0x1ddcf0,_0x26c62f,_0x42e6e3){return new BPromise(function(_0x3039e6,_0x10dc96){return client[_0x25e0('0xd')](_0x1ddcf0,_0x42e6e3)['then'](function(_0xa4beeb){logger[_0x25e0('0xe')](_0x25e0('0xf'),_0x26c62f,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26c62f,'request\x20sent',JSON[_0x25e0('0x10')](_0xa4beeb));if(_0xa4beeb[_0x25e0('0x11')]){if(_0xa4beeb['error'][_0x25e0('0x12')]===0x1f4){logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb['error'][_0x25e0('0x13')]);return _0x10dc96(_0xa4beeb['error'][_0x25e0('0x13')]);}logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);return _0x3039e6(_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);}else{logger['info'](_0x25e0('0xf'),_0x26c62f,'request\x20sent');_0x3039e6(_0xa4beeb['result'][_0x25e0('0x13')]);}})['catch'](function(_0x39c631){logger[_0x25e0('0x11')](_0x25e0('0xf'),_0x26c62f,_0x39c631);_0x10dc96(_0x39c631);});});}exports[_0x25e0('0x14')]=function(_0xff9e95){var _0x5b7add=this;return new Promise(function(_0x3cd388,_0x600dff){return db[_0x25e0('0x15')][_0x25e0('0x16')]({'raw':_0xff9e95[_0x25e0('0x17')]?_0xff9e95['options']['raw']===undefined?!![]:![]:!![],'where':_0xff9e95['options']?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x18')]||null:null,'attributes':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x19')]||null:null,'include':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')]?_[_0x25e0('0x1b')](_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')],function(_0x48fdfd){return{'model':db[_0x48fdfd[_0x25e0('0x1c')]],'as':_0x48fdfd['as'],'attributes':_0x48fdfd[_0x25e0('0x19')],'include':_0x48fdfd[_0x25e0('0x1a')]?_['map'](_0x48fdfd[_0x25e0('0x1a')],function(_0x129b6e){return{'model':db[_0x129b6e[_0x25e0('0x1c')]],'as':_0x129b6e['as'],'attributes':_0x129b6e['attributes'],'include':_0x129b6e['include']?_[_0x25e0('0x1b')](_0x129b6e[_0x25e0('0x1a')],function(_0x2a0392){return{'model':db[_0x2a0392['model']],'as':_0x2a0392['as'],'attributes':_0x2a0392[_0x25e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x25e0('0x1d')](function(_0x265813){logger[_0x25e0('0xe')](_0x25e0('0x14'),_0xff9e95);logger[_0x25e0('0x1e')]('ShowWhatsappAccount',_0xff9e95,JSON[_0x25e0('0x10')](_0x265813));_0x3cd388(_0x265813);})[_0x25e0('0x1f')](function(_0x4201cd){logger['error'](_0x25e0('0x14'),_0x4201cd['message'],_0xff9e95);_0x600dff(_0x5b7add[_0x25e0('0x11')](0x1f4,_0x4201cd[_0x25e0('0x13')]));});});};
\ No newline at end of file