Built motion from commit ecb45b58.|2.6.31
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 7251c02..bd9639f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x596b=['stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','where','limit','find','addTags','body','ids','spread','AddTags'];(function(_0x44c0e1,_0x28bfbf){var _0x5a3ba4=function(_0x44730f){while(--_0x44730f){_0x44c0e1['push'](_0x44c0e1['shift']());}};_0x5a3ba4(++_0x28bfbf);}(_0x596b,0xef));var _0xb596=function(_0x462e9d,_0x49a430){_0x462e9d=_0x462e9d-0x0;var _0x5bb599=_0x596b[_0x462e9d];return _0x5bb599;};'use strict';var _=require('lodash');var util=require(_0xb596('0x0'));var moment=require(_0xb596('0x1'));var BPromise=require('bluebird');var rs=require(_0xb596('0x2'));var fs=require('fs');var Redis=require(_0xb596('0x3'));var db=require(_0xb596('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb596('0x5'))('rpc');var config=require(_0xb596('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb596('0x7')][_0xb596('0x8')]({'port':0x232a});config[_0xb596('0x9')]=_['defaults'](config[_0xb596('0x9')],{'host':_0xb596('0xa'),'port':0x18eb});var socket=require(_0xb596('0xb'))(new Redis(config[_0xb596('0x9')]));require(_0xb596('0xc'))['register'](socket);function respondWithRpcPromise(_0x2897d1,_0x26371f,_0x2e15ce){return new BPromise(function(_0x586a9b,_0x44fc14){return client['request'](_0x2897d1,_0x2e15ce)[_0xb596('0xd')](function(_0x2fa5d2){logger[_0xb596('0xe')](_0xb596('0xf'),_0x26371f,_0xb596('0x10'));logger[_0xb596('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x26371f,_0xb596('0x10'),JSON['stringify'](_0x2fa5d2));if(_0x2fa5d2[_0xb596('0x12')]){if(_0x2fa5d2[_0xb596('0x12')][_0xb596('0x13')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,_0x2fa5d2[_0xb596('0x12')][_0xb596('0x14')]);return _0x44fc14(_0x2fa5d2[_0xb596('0x12')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,_0x2fa5d2[_0xb596('0x12')][_0xb596('0x14')]);return _0x586a9b(_0x2fa5d2[_0xb596('0x12')]['message']);}else{logger[_0xb596('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x26371f,'request\x20sent');_0x586a9b(_0x2fa5d2['result'][_0xb596('0x14')]);}})[_0xb596('0x15')](function(_0x8836d3){logger['error'](_0xb596('0xf'),_0x26371f,_0x8836d3);_0x44fc14(_0x8836d3);});});}exports[_0xb596('0x16')]=function(_0x344e0c){var _0x22a9be=this;return new Promise(function(_0x117709,_0x41f234){return db[_0xb596('0x17')]['update'](_0x344e0c['body'],{'raw':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options'][_0xb596('0x19')]||null:null,'attributes':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options']['attributes']||null:null,'limit':_0x344e0c[_0xb596('0x18')]?_0x344e0c['options'][_0xb596('0x1a')]||null:null})['then'](function(_0x408bdf){logger['info']('UpdateWhatsappInteraction',_0x344e0c);logger[_0xb596('0x11')](_0xb596('0x16'),_0x344e0c,JSON['stringify'](_0x408bdf));_0x117709(_0x408bdf);})[_0xb596('0x15')](function(_0x31f077){logger[_0xb596('0x12')](_0xb596('0x16'),_0x31f077[_0xb596('0x14')],_0x344e0c);_0x41f234(_0x22a9be[_0xb596('0x12')](0x1f4,_0x31f077[_0xb596('0x14')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x238a36){return new Promise(function(_0x2b7537,_0x41f1df){return db[_0xb596('0x17')][_0xb596('0x1b')]({'where':_0x238a36[_0xb596('0x18')]?_0x238a36[_0xb596('0x18')]['where']||null:null})[_0xb596('0xd')](function(_0x49c799){if(_0x49c799){return _0x49c799[_0xb596('0x1c')](_0x238a36[_0xb596('0x1d')][_0xb596('0x1e')],_['omit'](_0x238a36[_0xb596('0x1d')],['ids','id'])||{});}})[_0xb596('0x1f')](function(_0x387d1a){logger[_0xb596('0xe')](_0xb596('0x20'),_0x238a36);logger[_0xb596('0x11')]('AddTags',_0x238a36,JSON[_0xb596('0x21')](_0x387d1a));_0x2b7537(_0x387d1a);})[_0xb596('0x15')](function(_0x224596){logger['error'](_0xb596('0x20'),_0x224596[_0xb596('0x14')],_0x238a36);_0x41f1df(_this[_0xb596('0x12')](0x1f4,_0x224596[_0xb596('0x14')]));});});};
\ No newline at end of file
+var _0x898c=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToWhatsappInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent'];(function(_0x146692,_0x4ac837){var _0x4dd5d0=function(_0xed2df2){while(--_0xed2df2){_0x146692['push'](_0x146692['shift']());}};_0x4dd5d0(++_0x4ac837);}(_0x898c,0xe4));var _0xc898=function(_0x2e2b45,_0x2a07e3){_0x2e2b45=_0x2e2b45-0x0;var _0x2bf3c2=_0x898c[_0x2e2b45];return _0x2bf3c2;};'use strict';var _=require(_0xc898('0x0'));var util=require(_0xc898('0x1'));var moment=require(_0xc898('0x2'));var BPromise=require(_0xc898('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc898('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc898('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc898('0x6'));var client=jayson[_0xc898('0x7')][_0xc898('0x8')]({'port':0x232a});config[_0xc898('0x9')]=_[_0xc898('0xa')](config[_0xc898('0x9')],{'host':_0xc898('0xb'),'port':0x18eb});var socket=require(_0xc898('0xc'))(new Redis(config[_0xc898('0x9')]));require(_0xc898('0xd'))['register'](socket);function respondWithRpcPromise(_0x402e17,_0x49fe16,_0x31bca6){return new BPromise(function(_0x214c45,_0x3689aa){return client[_0xc898('0xe')](_0x402e17,_0x31bca6)[_0xc898('0xf')](function(_0x2494b7){logger[_0xc898('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x49fe16,_0xc898('0x11'));logger[_0xc898('0x12')](_0xc898('0x13'),_0x49fe16,_0xc898('0x11'),JSON[_0xc898('0x14')](_0x2494b7));if(_0x2494b7[_0xc898('0x15')]){if(_0x2494b7['error'][_0xc898('0x16')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x49fe16,_0x2494b7[_0xc898('0x15')][_0xc898('0x17')]);return _0x3689aa(_0x2494b7[_0xc898('0x15')]['message']);}logger[_0xc898('0x15')](_0xc898('0x18'),_0x49fe16,_0x2494b7['error'][_0xc898('0x17')]);return _0x214c45(_0x2494b7[_0xc898('0x15')]['message']);}else{logger[_0xc898('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x49fe16,_0xc898('0x11'));_0x214c45(_0x2494b7['result'][_0xc898('0x17')]);}})['catch'](function(_0x19e8c0){logger[_0xc898('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x49fe16,_0x19e8c0);_0x3689aa(_0x19e8c0);});});}exports[_0xc898('0x19')]=function(_0x4056db){var _0x4ca0a8=this;return new Promise(function(_0x54dc9b,_0x46b95f){return db[_0xc898('0x1a')][_0xc898('0x1b')](_0x4056db[_0xc898('0x1c')],{'raw':_0x4056db[_0xc898('0x1d')]?_0x4056db[_0xc898('0x1d')][_0xc898('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4056db[_0xc898('0x1d')]?_0x4056db['options'][_0xc898('0x1f')]||null:null,'attributes':_0x4056db['options']?_0x4056db[_0xc898('0x1d')][_0xc898('0x20')]||null:null,'limit':_0x4056db[_0xc898('0x1d')]?_0x4056db['options'][_0xc898('0x21')]||null:null})[_0xc898('0xf')](function(_0xc5a757){logger[_0xc898('0x10')](_0xc898('0x19'),_0x4056db);logger['debug']('UpdateWhatsappInteraction',_0x4056db,JSON[_0xc898('0x14')](_0xc5a757));_0x54dc9b(_0xc5a757);})[_0xc898('0x22')](function(_0x24da0d){logger[_0xc898('0x15')]('UpdateWhatsappInteraction',_0x24da0d[_0xc898('0x17')],_0x4056db);_0x46b95f(_0x4ca0a8[_0xc898('0x15')](0x1f4,_0x24da0d[_0xc898('0x17')]));});});};exports[_0xc898('0x23')]=function(_0x529321){return new Promise(function(_0x25f945,_0x303f00){return db[_0xc898('0x1a')]['find']({'where':_0x529321['options']?_0x529321['options']['where']||null:null})[_0xc898('0xf')](function(_0x336f93){if(_0x336f93){return _0x336f93[_0xc898('0x24')](_0x529321[_0xc898('0x1c')]['ids'],_[_0xc898('0x25')](_0x529321['body'],[_0xc898('0x26'),'id'])||{});}})[_0xc898('0x27')](function(_0x47480f){logger[_0xc898('0x10')](_0xc898('0x28'),_0x529321);logger['debug'](_0xc898('0x28'),_0x529321,JSON[_0xc898('0x14')](_0x47480f));_0x25f945(_0x47480f);})[_0xc898('0x22')](function(_0x322348){logger[_0xc898('0x15')](_0xc898('0x28'),_0x322348[_0xc898('0x17')],_0x529321);_0x303f00(_this[_0xc898('0x15')](0x1f4,_0x322348[_0xc898('0x17')]));});});};
\ No newline at end of file