Built motion from commit 9efc8423.|2.6.31
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 630855e..d10b3e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x617a=['WhatsappInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction'];(function(_0x13d27f,_0x21369d){var _0x45f178=function(_0x3a248b){while(--_0x3a248b){_0x13d27f['push'](_0x13d27f['shift']());}};_0x45f178(++_0x21369d);}(_0x617a,0x1d5));var _0xa617=function(_0x5e0202,_0x2e7142){_0x5e0202=_0x5e0202-0x0;var _0x53d7c0=_0x617a[_0x5e0202];return _0x53d7c0;};'use strict';var _=require(_0xa617('0x0'));var util=require(_0xa617('0x1'));var moment=require(_0xa617('0x2'));var BPromise=require(_0xa617('0x3'));var rs=require(_0xa617('0x4'));var fs=require('fs');var Redis=require(_0xa617('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa617('0x6'));var logger=require('../../config/logger')(_0xa617('0x7'));var config=require(_0xa617('0x8'));var jayson=require(_0xa617('0x9'));var client=jayson[_0xa617('0xa')]['http']({'port':0x232a});config[_0xa617('0xb')]=_[_0xa617('0xc')](config[_0xa617('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa617('0xd'))(new Redis(config[_0xa617('0xb')]));require(_0xa617('0xe'))[_0xa617('0xf')](socket);function respondWithRpcPromise(_0x44bf81,_0x49b33b,_0x20cab9){return new BPromise(function(_0x345284,_0x26baf3){return client[_0xa617('0x10')](_0x44bf81,_0x20cab9)[_0xa617('0x11')](function(_0x15fc5c){logger[_0xa617('0x12')](_0xa617('0x13'),_0x49b33b,'request\x20sent');logger[_0xa617('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x49b33b,_0xa617('0x15'),JSON[_0xa617('0x16')](_0x15fc5c));if(_0x15fc5c[_0xa617('0x17')]){if(_0x15fc5c[_0xa617('0x17')]['code']===0x1f4){logger['error'](_0xa617('0x13'),_0x49b33b,_0x15fc5c[_0xa617('0x17')][_0xa617('0x18')]);return _0x26baf3(_0x15fc5c['error'][_0xa617('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x49b33b,_0x15fc5c['error'][_0xa617('0x18')]);return _0x345284(_0x15fc5c[_0xa617('0x17')][_0xa617('0x18')]);}else{logger[_0xa617('0x12')](_0xa617('0x13'),_0x49b33b,_0xa617('0x15'));_0x345284(_0x15fc5c[_0xa617('0x19')][_0xa617('0x18')]);}})[_0xa617('0x1a')](function(_0x23197b){logger[_0xa617('0x17')](_0xa617('0x13'),_0x49b33b,_0x23197b);_0x26baf3(_0x23197b);});});}exports[_0xa617('0x1b')]=function(_0x7e6296){var _0x239f84=this;return new Promise(function(_0x510dba,_0x50ebe1){return db['WhatsappInteraction'][_0xa617('0x1c')](_0x7e6296[_0xa617('0x1d')],{'raw':_0x7e6296[_0xa617('0x1e')]?_0x7e6296[_0xa617('0x1e')][_0xa617('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7e6296[_0xa617('0x1e')]?_0x7e6296[_0xa617('0x1e')]['where']||null:null,'attributes':_0x7e6296[_0xa617('0x1e')]?_0x7e6296[_0xa617('0x1e')][_0xa617('0x20')]||null:null,'limit':_0x7e6296['options']?_0x7e6296[_0xa617('0x1e')][_0xa617('0x21')]||null:null})[_0xa617('0x11')](function(_0x11e4e9){logger[_0xa617('0x12')](_0xa617('0x1b'),_0x7e6296);logger[_0xa617('0x14')](_0xa617('0x1b'),_0x7e6296,JSON[_0xa617('0x16')](_0x11e4e9));_0x510dba(_0x11e4e9);})['catch'](function(_0x3cdd40){logger[_0xa617('0x17')](_0xa617('0x1b'),_0x3cdd40['message'],_0x7e6296);_0x50ebe1(_0x239f84['error'](0x1f4,_0x3cdd40[_0xa617('0x18')]));});});};exports[_0xa617('0x22')]=function(_0x8b9892){return new Promise(function(_0x544170,_0x3c3fca){return db[_0xa617('0x23')][_0xa617('0x24')]({'where':_0x8b9892[_0xa617('0x1e')]?_0x8b9892[_0xa617('0x1e')][_0xa617('0x25')]||null:null})[_0xa617('0x11')](function(_0x51f39d){if(_0x51f39d){return _0x51f39d[_0xa617('0x26')](_0x8b9892[_0xa617('0x1d')][_0xa617('0x27')],_['omit'](_0x8b9892[_0xa617('0x1d')],[_0xa617('0x27'),'id'])||{});}})[_0xa617('0x28')](function(_0x4a7484){logger[_0xa617('0x12')](_0xa617('0x29'),_0x8b9892);logger[_0xa617('0x14')](_0xa617('0x29'),_0x8b9892,JSON['stringify'](_0x4a7484));_0x544170(_0x4a7484);})['catch'](function(_0x55c617){logger[_0xa617('0x17')](_0xa617('0x29'),_0x55c617[_0xa617('0x18')],_0x8b9892);_0x3c3fca(_this['error'](0x1f4,_0x55c617[_0xa617('0x18')]));});});};
\ No newline at end of file
+var _0x05f7=['stringify','code','error','message','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','catch','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x05f7,0xb9));var _0x705f=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x05f7[_0x35b195];return _0x2433bf;};'use strict';var _=require(_0x705f('0x0'));var util=require(_0x705f('0x1'));var moment=require(_0x705f('0x2'));var BPromise=require(_0x705f('0x3'));var rs=require(_0x705f('0x4'));var fs=require('fs');var Redis=require(_0x705f('0x5'));var db=require(_0x705f('0x6'))['db'];var utils=require(_0x705f('0x7'));var logger=require('../../config/logger')(_0x705f('0x8'));var config=require(_0x705f('0x9'));var jayson=require(_0x705f('0xa'));var client=jayson[_0x705f('0xb')][_0x705f('0xc')]({'port':0x232a});config['redis']=_[_0x705f('0xd')](config[_0x705f('0xe')],{'host':_0x705f('0xf'),'port':0x18eb});var socket=require(_0x705f('0x10'))(new Redis(config[_0x705f('0xe')]));require('./whatsappInteraction.socket')[_0x705f('0x11')](socket);function respondWithRpcPromise(_0x3cb9f,_0x23f7b0,_0x214d89){return new BPromise(function(_0x5eb807,_0x5e4d25){return client[_0x705f('0x12')](_0x3cb9f,_0x214d89)[_0x705f('0x13')](function(_0x4f9f52){logger[_0x705f('0x14')](_0x705f('0x15'),_0x23f7b0,'request\x20sent');logger[_0x705f('0x16')](_0x705f('0x17'),_0x23f7b0,_0x705f('0x18'),JSON[_0x705f('0x19')](_0x4f9f52));if(_0x4f9f52['error']){if(_0x4f9f52['error'][_0x705f('0x1a')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x23f7b0,_0x4f9f52[_0x705f('0x1b')][_0x705f('0x1c')]);return _0x5e4d25(_0x4f9f52['error'][_0x705f('0x1c')]);}logger[_0x705f('0x1b')](_0x705f('0x15'),_0x23f7b0,_0x4f9f52[_0x705f('0x1b')][_0x705f('0x1c')]);return _0x5eb807(_0x4f9f52['error']['message']);}else{logger[_0x705f('0x14')](_0x705f('0x15'),_0x23f7b0,_0x705f('0x18'));_0x5eb807(_0x4f9f52['result'][_0x705f('0x1c')]);}})['catch'](function(_0x258fd0){logger[_0x705f('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x23f7b0,_0x258fd0);_0x5e4d25(_0x258fd0);});});}exports[_0x705f('0x1d')]=function(_0x2c9a36){var _0x3cc931=this;return new Promise(function(_0x117bf0,_0x514918){return db[_0x705f('0x1e')]['update'](_0x2c9a36[_0x705f('0x1f')],{'raw':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36[_0x705f('0x20')][_0x705f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9a36['options']?_0x2c9a36[_0x705f('0x20')][_0x705f('0x22')]||null:null,'attributes':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36['options'][_0x705f('0x23')]||null:null,'limit':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36[_0x705f('0x20')][_0x705f('0x24')]||null:null})['then'](function(_0x2f34a7){logger['info'](_0x705f('0x1d'),_0x2c9a36);logger['debug'](_0x705f('0x1d'),_0x2c9a36,JSON['stringify'](_0x2f34a7));_0x117bf0(_0x2f34a7);})[_0x705f('0x25')](function(_0xa04c09){logger['error'](_0x705f('0x1d'),_0xa04c09[_0x705f('0x1c')],_0x2c9a36);_0x514918(_0x3cc931['error'](0x1f4,_0xa04c09[_0x705f('0x1c')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x12452a){return new Promise(function(_0x28b61b,_0x23ae4d){return db[_0x705f('0x1e')]['find']({'where':_0x12452a['options']?_0x12452a['options'][_0x705f('0x22')]||null:null})[_0x705f('0x13')](function(_0x163947){if(_0x163947){return _0x163947['addTags'](_0x12452a[_0x705f('0x1f')][_0x705f('0x26')],_[_0x705f('0x27')](_0x12452a[_0x705f('0x1f')],[_0x705f('0x26'),'id'])||{});}})[_0x705f('0x28')](function(_0x27e01a){logger[_0x705f('0x14')](_0x705f('0x29'),_0x12452a);logger[_0x705f('0x16')](_0x705f('0x29'),_0x12452a,JSON[_0x705f('0x19')](_0x27e01a));_0x28b61b(_0x27e01a);})[_0x705f('0x25')](function(_0xbab535){logger['error'](_0x705f('0x29'),_0xbab535[_0x705f('0x1c')],_0x12452a);_0x23ae4d(_this[_0x705f('0x1b')](0x1f4,_0xbab535[_0x705f('0x1c')]));});});};
\ No newline at end of file