Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / api / whatsappQueue / whatsappQueue.rpc.js
index c00360e..5e0ba16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24cf=['error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowWhatsappQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1d3756,_0x3411bb){var _0x3dd1a8=function(_0x454358){while(--_0x454358){_0x1d3756['push'](_0x1d3756['shift']());}};_0x3dd1a8(++_0x3411bb);}(_0x24cf,0x17b));var _0xf24c=function(_0xf60c8,_0xf932a4){_0xf60c8=_0xf60c8-0x0;var _0x3816a1=_0x24cf[_0xf60c8];return _0x3816a1;};'use strict';var _=require('lodash');var util=require(_0xf24c('0x0'));var moment=require(_0xf24c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client'][_0xf24c('0x9')]({'port':0x232a});config[_0xf24c('0xa')]=_[_0xf24c('0xb')](config['redis'],{'host':_0xf24c('0xc'),'port':0x18eb});var socket=require(_0xf24c('0xd'))(new Redis(config[_0xf24c('0xa')]));require(_0xf24c('0xe'))[_0xf24c('0xf')](socket);function respondWithRpcPromise(_0x2325f4,_0x31645b,_0xf1ab01){return new BPromise(function(_0x286101,_0x3fbf85){return client['request'](_0x2325f4,_0xf1ab01)['then'](function(_0x90fe90){logger[_0xf24c('0x10')](_0xf24c('0x11'),_0x31645b,_0xf24c('0x12'));logger[_0xf24c('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x31645b,'request\x20sent',JSON[_0xf24c('0x14')](_0x90fe90));if(_0x90fe90[_0xf24c('0x15')]){if(_0x90fe90[_0xf24c('0x15')][_0xf24c('0x16')]===0x1f4){logger[_0xf24c('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0x90fe90[_0xf24c('0x15')]['message']);return _0x3fbf85(_0x90fe90[_0xf24c('0x15')][_0xf24c('0x17')]);}logger['error'](_0xf24c('0x11'),_0x31645b,_0x90fe90[_0xf24c('0x15')][_0xf24c('0x17')]);return _0x286101(_0x90fe90[_0xf24c('0x15')]['message']);}else{logger[_0xf24c('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0xf24c('0x12'));_0x286101(_0x90fe90[_0xf24c('0x18')]['message']);}})[_0xf24c('0x19')](function(_0x2bd9d2){logger[_0xf24c('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0x2bd9d2);_0x3fbf85(_0x2bd9d2);});});}exports[_0xf24c('0x1a')]=function(_0x516df8){var _0x1d043b=this;return new Promise(function(_0x4dae4e,_0x59b000){return db[_0xf24c('0x1b')][_0xf24c('0x1c')]({'raw':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x516df8['options']?_0x516df8[_0xf24c('0x1d')][_0xf24c('0x1e')]||null:null,'attributes':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')]['attributes']||null:null,'limit':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')][_0xf24c('0x1f')]||null:null,'include':_0x516df8['options']?_0x516df8['options'][_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x516df8[_0xf24c('0x1d')][_0xf24c('0x20')],function(_0x622aeb){return{'model':db[_0x622aeb[_0xf24c('0x22')]],'as':_0x622aeb['as'],'attributes':_0x622aeb['attributes'],'include':_0x622aeb[_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x622aeb[_0xf24c('0x20')],function(_0x389688){return{'model':db[_0x389688[_0xf24c('0x22')]],'as':_0x389688['as'],'attributes':_0x389688[_0xf24c('0x23')],'include':_0x389688['include']?_['map'](_0x389688['include'],function(_0xfc67e1){return{'model':db[_0xfc67e1['model']],'as':_0xfc67e1['as'],'attributes':_0xfc67e1[_0xf24c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf24c('0x24')](function(_0x6baadd){logger[_0xf24c('0x10')]('GetWhatsappQueue',_0x516df8);logger[_0xf24c('0x13')](_0xf24c('0x1a'),_0x516df8,JSON[_0xf24c('0x14')](_0x6baadd));_0x4dae4e(_0x6baadd);})[_0xf24c('0x19')](function(_0x2fbd6a){logger[_0xf24c('0x15')]('GetWhatsappQueue',_0x2fbd6a[_0xf24c('0x17')],_0x516df8);_0x59b000(_0x1d043b['error'](0x1f4,_0x2fbd6a[_0xf24c('0x17')]));});});};exports[_0xf24c('0x25')]=function(_0x25ca7d){var _0x3bf5a7=this;return new Promise(function(_0x31e854,_0xe982a0){return db[_0xf24c('0x1b')][_0xf24c('0x26')]({'raw':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x27')]===undefined?!![]:![]:!![],'where':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x1e')]||null:null,'attributes':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')]['attributes']||null:null,'include':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')]['include']?_[_0xf24c('0x21')](_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x20')],function(_0x350cdf){return{'model':db[_0x350cdf['model']],'as':_0x350cdf['as'],'attributes':_0x350cdf[_0xf24c('0x23')],'include':_0x350cdf[_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x350cdf['include'],function(_0x1b014a){return{'model':db[_0x1b014a[_0xf24c('0x22')]],'as':_0x1b014a['as'],'attributes':_0x1b014a[_0xf24c('0x23')],'include':_0x1b014a[_0xf24c('0x20')]?_['map'](_0x1b014a[_0xf24c('0x20')],function(_0x3b06e8){return{'model':db[_0x3b06e8[_0xf24c('0x22')]],'as':_0x3b06e8['as'],'attributes':_0x3b06e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf24c('0x24')](function(_0x21dc1f){logger[_0xf24c('0x10')](_0xf24c('0x25'),_0x25ca7d);logger[_0xf24c('0x13')](_0xf24c('0x25'),_0x25ca7d,JSON[_0xf24c('0x14')](_0x21dc1f));_0x31e854(_0x21dc1f);})['catch'](function(_0x187564){logger[_0xf24c('0x15')](_0xf24c('0x25'),_0x187564[_0xf24c('0x17')],_0x25ca7d);_0xe982a0(_0x3bf5a7[_0xf24c('0x15')](0x1f4,_0x187564[_0xf24c('0x17')]));});});};
\ No newline at end of file
+var _0xd6c1=['message','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x304123,_0x31caa9){var _0x50c2a3=function(_0xfcdc76){while(--_0xfcdc76){_0x304123['push'](_0x304123['shift']());}};_0x50c2a3(++_0x31caa9);}(_0xd6c1,0x1d6));var _0x1d6c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd6c1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1d6c('0x0'));var util=require(_0x1d6c('0x1'));var moment=require('moment');var BPromise=require(_0x1d6c('0x2'));var rs=require(_0x1d6c('0x3'));var fs=require('fs');var Redis=require(_0x1d6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d6c('0x5'));var logger=require('../../config/logger')(_0x1d6c('0x6'));var config=require(_0x1d6c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d6c('0x8')][_0x1d6c('0x9')]({'port':0x232a});config[_0x1d6c('0xa')]=_[_0x1d6c('0xb')](config[_0x1d6c('0xa')],{'host':_0x1d6c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d6c('0xa')]));require(_0x1d6c('0xd'))[_0x1d6c('0xe')](socket);function respondWithRpcPromise(_0x51adf0,_0x495c72,_0x4aeeda){return new BPromise(function(_0x2732b6,_0x946681){return client[_0x1d6c('0xf')](_0x51adf0,_0x4aeeda)[_0x1d6c('0x10')](function(_0x445116){logger[_0x1d6c('0x11')](_0x1d6c('0x12'),_0x495c72,'request\x20sent');logger[_0x1d6c('0x13')](_0x1d6c('0x14'),_0x495c72,_0x1d6c('0x15'),JSON[_0x1d6c('0x16')](_0x445116));if(_0x445116[_0x1d6c('0x17')]){if(_0x445116[_0x1d6c('0x17')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x495c72,_0x445116[_0x1d6c('0x17')][_0x1d6c('0x18')]);return _0x946681(_0x445116[_0x1d6c('0x17')]['message']);}logger[_0x1d6c('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x495c72,_0x445116['error'][_0x1d6c('0x18')]);return _0x2732b6(_0x445116[_0x1d6c('0x17')]['message']);}else{logger[_0x1d6c('0x11')](_0x1d6c('0x12'),_0x495c72,_0x1d6c('0x15'));_0x2732b6(_0x445116['result'][_0x1d6c('0x18')]);}})[_0x1d6c('0x19')](function(_0x2fb877){logger[_0x1d6c('0x17')](_0x1d6c('0x12'),_0x495c72,_0x2fb877);_0x946681(_0x2fb877);});});}exports[_0x1d6c('0x1a')]=function(_0x2dce23){var _0x2837d3=this;return new Promise(function(_0x508fbe,_0x9a9f70){return db['WhatsappQueue'][_0x1d6c('0x1b')]({'raw':_0x2dce23['options']?_0x2dce23['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dce23['options']?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x1d')]||null:null,'attributes':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x1e')]||null:null,'limit':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23['options'][_0x1d6c('0x1f')]||null:null,'include':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x20')],function(_0x47b75c){return{'model':db[_0x47b75c[_0x1d6c('0x22')]],'as':_0x47b75c['as'],'attributes':_0x47b75c[_0x1d6c('0x1e')],'include':_0x47b75c[_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x47b75c[_0x1d6c('0x20')],function(_0x4a9717){return{'model':db[_0x4a9717[_0x1d6c('0x22')]],'as':_0x4a9717['as'],'attributes':_0x4a9717[_0x1d6c('0x1e')],'include':_0x4a9717['include']?_[_0x1d6c('0x21')](_0x4a9717[_0x1d6c('0x20')],function(_0x33faba){return{'model':db[_0x33faba[_0x1d6c('0x22')]],'as':_0x33faba['as'],'attributes':_0x33faba[_0x1d6c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d6c('0x10')](function(_0x4e7f93){logger[_0x1d6c('0x11')](_0x1d6c('0x1a'),_0x2dce23);logger[_0x1d6c('0x13')]('GetWhatsappQueue',_0x2dce23,JSON[_0x1d6c('0x16')](_0x4e7f93));_0x508fbe(_0x4e7f93);})['catch'](function(_0xbc801){logger['error'](_0x1d6c('0x1a'),_0xbc801[_0x1d6c('0x18')],_0x2dce23);_0x9a9f70(_0x2837d3[_0x1d6c('0x17')](0x1f4,_0xbc801['message']));});});};exports[_0x1d6c('0x23')]=function(_0x3eedb5){var _0x12298d=this;return new Promise(function(_0x30928e,_0x1678c1){return db['WhatsappQueue'][_0x1d6c('0x24')]({'raw':_0x3eedb5['options']?_0x3eedb5['options'][_0x1d6c('0x25')]===undefined?!![]:![]:!![],'where':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x1d')]||null:null,'attributes':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x1e')]||null:null,'include':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x20')],function(_0x157829){return{'model':db[_0x157829[_0x1d6c('0x22')]],'as':_0x157829['as'],'attributes':_0x157829[_0x1d6c('0x1e')],'include':_0x157829['include']?_[_0x1d6c('0x21')](_0x157829[_0x1d6c('0x20')],function(_0x1a461f){return{'model':db[_0x1a461f[_0x1d6c('0x22')]],'as':_0x1a461f['as'],'attributes':_0x1a461f[_0x1d6c('0x1e')],'include':_0x1a461f[_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x1a461f[_0x1d6c('0x20')],function(_0x280fac){return{'model':db[_0x280fac['model']],'as':_0x280fac['as'],'attributes':_0x280fac[_0x1d6c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d6c('0x10')](function(_0x47b491){logger[_0x1d6c('0x11')](_0x1d6c('0x23'),_0x3eedb5);logger['debug'](_0x1d6c('0x23'),_0x3eedb5,JSON['stringify'](_0x47b491));_0x30928e(_0x47b491);})['catch'](function(_0x2d83fb){logger[_0x1d6c('0x17')]('ShowWhatsappQueue',_0x2d83fb[_0x1d6c('0x18')],_0x3eedb5);_0x1678c1(_0x12298d[_0x1d6c('0x17')](0x1f4,_0x2d83fb[_0x1d6c('0x18')]));});});};
\ No newline at end of file