Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / whatsappAccount / whatsappAccount.rpc.js
index 741189e..9a30a7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ecb=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','attributes','include','model','map','info','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x3ecb,0x15e));var _0xb3ec=function(_0x2db896,_0x165786){_0x2db896=_0x2db896-0x0;var _0x3a281f=_0x3ecb[_0x2db896];return _0x3a281f;};'use strict';var _=require(_0xb3ec('0x0'));var util=require(_0xb3ec('0x1'));var moment=require(_0xb3ec('0x2'));var BPromise=require(_0xb3ec('0x3'));var rs=require(_0xb3ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3ec('0x5'))['db'];var utils=require(_0xb3ec('0x6'));var logger=require(_0xb3ec('0x7'))('rpc');var config=require(_0xb3ec('0x8'));var jayson=require(_0xb3ec('0x9'));var client=jayson[_0xb3ec('0xa')]['http']({'port':0x232a});config[_0xb3ec('0xb')]=_[_0xb3ec('0xc')](config[_0xb3ec('0xb')],{'host':_0xb3ec('0xd'),'port':0x18eb});var socket=require(_0xb3ec('0xe'))(new Redis(config[_0xb3ec('0xb')]));require(_0xb3ec('0xf'))[_0xb3ec('0x10')](socket);function respondWithRpcPromise(_0x4583c1,_0x2df5be,_0x4c1bb4){return new BPromise(function(_0x12c8db,_0x4b232a){return client[_0xb3ec('0x11')](_0x4583c1,_0x4c1bb4)[_0xb3ec('0x12')](function(_0x38825e){logger['info'](_0xb3ec('0x13'),_0x2df5be,'request\x20sent');logger[_0xb3ec('0x14')](_0xb3ec('0x15'),_0x2df5be,_0xb3ec('0x16'),JSON['stringify'](_0x38825e));if(_0x38825e[_0xb3ec('0x17')]){if(_0x38825e[_0xb3ec('0x17')]['code']===0x1f4){logger[_0xb3ec('0x17')](_0xb3ec('0x13'),_0x2df5be,_0x38825e[_0xb3ec('0x17')][_0xb3ec('0x18')]);return _0x4b232a(_0x38825e[_0xb3ec('0x17')][_0xb3ec('0x18')]);}logger[_0xb3ec('0x17')](_0xb3ec('0x13'),_0x2df5be,_0x38825e[_0xb3ec('0x17')]['message']);return _0x12c8db(_0x38825e[_0xb3ec('0x17')][_0xb3ec('0x18')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2df5be,_0xb3ec('0x16'));_0x12c8db(_0x38825e[_0xb3ec('0x19')]['message']);}})[_0xb3ec('0x1a')](function(_0x5108eb){logger[_0xb3ec('0x17')](_0xb3ec('0x13'),_0x2df5be,_0x5108eb);_0x4b232a(_0x5108eb);});});}exports[_0xb3ec('0x1b')]=function(_0x33279f){var _0x413cb8=this;return new Promise(function(_0x12589f,_0x5b84e6){return db[_0xb3ec('0x1c')]['find']({'raw':_0x33279f[_0xb3ec('0x1d')]?_0x33279f[_0xb3ec('0x1d')][_0xb3ec('0x1e')]===undefined?!![]:![]:!![],'where':_0x33279f[_0xb3ec('0x1d')]?_0x33279f[_0xb3ec('0x1d')]['where']||null:null,'attributes':_0x33279f[_0xb3ec('0x1d')]?_0x33279f[_0xb3ec('0x1d')][_0xb3ec('0x1f')]||null:null,'include':_0x33279f[_0xb3ec('0x1d')]?_0x33279f[_0xb3ec('0x1d')][_0xb3ec('0x20')]?_['map'](_0x33279f['options'][_0xb3ec('0x20')],function(_0x13fe45){return{'model':db[_0x13fe45[_0xb3ec('0x21')]],'as':_0x13fe45['as'],'attributes':_0x13fe45['attributes'],'include':_0x13fe45[_0xb3ec('0x20')]?_[_0xb3ec('0x22')](_0x13fe45[_0xb3ec('0x20')],function(_0x3964af){return{'model':db[_0x3964af[_0xb3ec('0x21')]],'as':_0x3964af['as'],'attributes':_0x3964af[_0xb3ec('0x1f')],'include':_0x3964af[_0xb3ec('0x20')]?_[_0xb3ec('0x22')](_0x3964af[_0xb3ec('0x20')],function(_0x1f8805){return{'model':db[_0x1f8805[_0xb3ec('0x21')]],'as':_0x1f8805['as'],'attributes':_0x1f8805[_0xb3ec('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb3ec('0x12')](function(_0xf97eb5){logger[_0xb3ec('0x23')](_0xb3ec('0x1b'),_0x33279f);logger['debug'](_0xb3ec('0x1b'),_0x33279f,JSON[_0xb3ec('0x24')](_0xf97eb5));_0x12589f(_0xf97eb5);})[_0xb3ec('0x1a')](function(_0x2ea7ba){logger[_0xb3ec('0x17')](_0xb3ec('0x1b'),_0x2ea7ba[_0xb3ec('0x18')],_0x33279f);_0x5b84e6(_0x413cb8[_0xb3ec('0x17')](0x1f4,_0x2ea7ba[_0xb3ec('0x18')]));});});};
\ 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