Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index a3e3277..474b1de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9c4=['redis','defaults','localhost','./whatsappInteraction.socket','register','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','then','info','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xf9c4,0xc7));var _0x4f9c=function(_0x30bbfc,_0x326f7a){_0x30bbfc=_0x30bbfc-0x0;var _0x29f897=_0xf9c4[_0x30bbfc];return _0x29f897;};'use strict';var _=require(_0x4f9c('0x0'));var util=require(_0x4f9c('0x1'));var moment=require(_0x4f9c('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f9c('0x3'));var fs=require('fs');var Redis=require(_0x4f9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f9c('0x5'))(_0x4f9c('0x6'));var config=require(_0x4f9c('0x7'));var jayson=require(_0x4f9c('0x8'));var client=jayson[_0x4f9c('0x9')][_0x4f9c('0xa')]({'port':0x232a});config[_0x4f9c('0xb')]=_[_0x4f9c('0xc')](config['redis'],{'host':_0x4f9c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f9c('0xb')]));require(_0x4f9c('0xe'))[_0x4f9c('0xf')](socket);function respondWithRpcPromise(_0x313adf,_0x1b0f73,_0x2adfad){return new BPromise(function(_0x1395a7,_0x469ec5){return client[_0x4f9c('0x10')](_0x313adf,_0x2adfad)['then'](function(_0x25bd85){logger['info'](_0x4f9c('0x11'),_0x1b0f73,_0x4f9c('0x12'));logger[_0x4f9c('0x13')](_0x4f9c('0x14'),_0x1b0f73,_0x4f9c('0x12'),JSON[_0x4f9c('0x15')](_0x25bd85));if(_0x25bd85[_0x4f9c('0x16')]){if(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x17')]===0x1f4){logger[_0x4f9c('0x16')](_0x4f9c('0x11'),_0x1b0f73,_0x25bd85['error']['message']);return _0x469ec5(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);}logger[_0x4f9c('0x16')](_0x4f9c('0x11'),_0x1b0f73,_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);return _0x1395a7(_0x25bd85[_0x4f9c('0x16')][_0x4f9c('0x18')]);}else{logger['info'](_0x4f9c('0x11'),_0x1b0f73,_0x4f9c('0x12'));_0x1395a7(_0x25bd85[_0x4f9c('0x19')][_0x4f9c('0x18')]);}})[_0x4f9c('0x1a')](function(_0x1dfca3){logger[_0x4f9c('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1b0f73,_0x1dfca3);_0x469ec5(_0x1dfca3);});});}exports[_0x4f9c('0x1b')]=function(_0x5f3c51){var _0x29fdc1=this;return new Promise(function(_0x493a92,_0x1ae6c6){return db['WhatsappInteraction'][_0x4f9c('0x1c')](_0x5f3c51[_0x4f9c('0x1d')],{'raw':_0x5f3c51[_0x4f9c('0x1e')]?_0x5f3c51[_0x4f9c('0x1e')][_0x4f9c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3c51['options']?_0x5f3c51['options'][_0x4f9c('0x20')]||null:null,'attributes':_0x5f3c51['options']?_0x5f3c51[_0x4f9c('0x1e')]['attributes']||null:null,'limit':_0x5f3c51['options']?_0x5f3c51[_0x4f9c('0x1e')][_0x4f9c('0x21')]||null:null})[_0x4f9c('0x22')](function(_0x5883d5){logger[_0x4f9c('0x23')](_0x4f9c('0x1b'),_0x5f3c51);logger['debug']('UpdateWhatsappInteraction',_0x5f3c51,JSON[_0x4f9c('0x15')](_0x5883d5));_0x493a92(_0x5883d5);})['catch'](function(_0x3178c1){logger[_0x4f9c('0x16')]('UpdateWhatsappInteraction',_0x3178c1['message'],_0x5f3c51);_0x1ae6c6(_0x29fdc1['error'](0x1f4,_0x3178c1[_0x4f9c('0x18')]));});});};exports[_0x4f9c('0x24')]=function(_0x3c8420){return new Promise(function(_0x307cd2,_0x2c0939){return db[_0x4f9c('0x25')][_0x4f9c('0x26')]({'where':_0x3c8420[_0x4f9c('0x1e')]?_0x3c8420[_0x4f9c('0x1e')]['where']||null:null})[_0x4f9c('0x22')](function(_0xf11f71){if(_0xf11f71){return _0xf11f71[_0x4f9c('0x27')](_0x3c8420[_0x4f9c('0x1d')]['ids'],_['omit'](_0x3c8420['body'],[_0x4f9c('0x28'),'id'])||{});}})['spread'](function(_0x437436){logger[_0x4f9c('0x23')](_0x4f9c('0x29'),_0x3c8420);logger[_0x4f9c('0x13')](_0x4f9c('0x29'),_0x3c8420,JSON[_0x4f9c('0x15')](_0x437436));_0x307cd2(_0x437436);})[_0x4f9c('0x1a')](function(_0x1383de){logger['error'](_0x4f9c('0x29'),_0x1383de['message'],_0x3c8420);_0x2c0939(_this['error'](0x1f4,_0x1383de[_0x4f9c('0x18')]));});});};
\ No newline at end of file
+var _0x0368=['catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4c15ee,_0x7d6508){var _0x57327b=function(_0x5845a9){while(--_0x5845a9){_0x4c15ee['push'](_0x4c15ee['shift']());}};_0x57327b(++_0x7d6508);}(_0x0368,0xdc));var _0x8036=function(_0x56f935,_0xbb3e13){_0x56f935=_0x56f935-0x0;var _0x25ff2f=_0x0368[_0x56f935];return _0x25ff2f;};'use strict';var _=require(_0x8036('0x0'));var util=require(_0x8036('0x1'));var moment=require(_0x8036('0x2'));var BPromise=require(_0x8036('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8036('0x4'));var db=require(_0x8036('0x5'))['db'];var utils=require(_0x8036('0x6'));var logger=require(_0x8036('0x7'))(_0x8036('0x8'));var config=require(_0x8036('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8036('0xa')]({'port':0x232a});config[_0x8036('0xb')]=_[_0x8036('0xc')](config[_0x8036('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8036('0xd'))[_0x8036('0xe')](socket);function respondWithRpcPromise(_0x36bb94,_0xdd7ae5,_0x2015e1){return new BPromise(function(_0x122fad,_0x523635){return client[_0x8036('0xf')](_0x36bb94,_0x2015e1)[_0x8036('0x10')](function(_0x3052c2){logger[_0x8036('0x11')](_0x8036('0x12'),_0xdd7ae5,_0x8036('0x13'));logger[_0x8036('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xdd7ae5,'request\x20sent',JSON[_0x8036('0x15')](_0x3052c2));if(_0x3052c2[_0x8036('0x16')]){if(_0x3052c2[_0x8036('0x16')][_0x8036('0x17')]===0x1f4){logger[_0x8036('0x16')](_0x8036('0x12'),_0xdd7ae5,_0x3052c2[_0x8036('0x16')][_0x8036('0x18')]);return _0x523635(_0x3052c2['error'][_0x8036('0x18')]);}logger['error'](_0x8036('0x12'),_0xdd7ae5,_0x3052c2[_0x8036('0x16')]['message']);return _0x122fad(_0x3052c2[_0x8036('0x16')][_0x8036('0x18')]);}else{logger[_0x8036('0x11')](_0x8036('0x12'),_0xdd7ae5,'request\x20sent');_0x122fad(_0x3052c2[_0x8036('0x19')]['message']);}})[_0x8036('0x1a')](function(_0x1332d3){logger[_0x8036('0x16')](_0x8036('0x12'),_0xdd7ae5,_0x1332d3);_0x523635(_0x1332d3);});});}exports[_0x8036('0x1b')]=function(_0x36d38b){var _0x5e982d=this;return new Promise(function(_0x281e18,_0x31e063){return db[_0x8036('0x1c')][_0x8036('0x1d')](_0x36d38b[_0x8036('0x1e')],{'raw':_0x36d38b[_0x8036('0x1f')]?_0x36d38b['options'][_0x8036('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d38b['options']?_0x36d38b[_0x8036('0x1f')][_0x8036('0x21')]||null:null,'attributes':_0x36d38b[_0x8036('0x1f')]?_0x36d38b[_0x8036('0x1f')][_0x8036('0x22')]||null:null,'limit':_0x36d38b[_0x8036('0x1f')]?_0x36d38b[_0x8036('0x1f')][_0x8036('0x23')]||null:null})[_0x8036('0x10')](function(_0x40e5d9){logger['info']('UpdateWhatsappInteraction',_0x36d38b);logger[_0x8036('0x14')](_0x8036('0x1b'),_0x36d38b,JSON[_0x8036('0x15')](_0x40e5d9));_0x281e18(_0x40e5d9);})[_0x8036('0x1a')](function(_0x1c579e){logger[_0x8036('0x16')](_0x8036('0x1b'),_0x1c579e[_0x8036('0x18')],_0x36d38b);_0x31e063(_0x5e982d['error'](0x1f4,_0x1c579e[_0x8036('0x18')]));});});};exports[_0x8036('0x24')]=function(_0x5e3879){return new Promise(function(_0x54035d,_0x10bdb6){return db[_0x8036('0x1c')][_0x8036('0x25')]({'where':_0x5e3879[_0x8036('0x1f')]?_0x5e3879[_0x8036('0x1f')][_0x8036('0x21')]||null:null})[_0x8036('0x10')](function(_0xcf6e21){if(_0xcf6e21){return _0xcf6e21['addTags'](_0x5e3879[_0x8036('0x1e')]['ids'],_[_0x8036('0x26')](_0x5e3879['body'],['ids','id'])||{});}})[_0x8036('0x27')](function(_0x484b2c){logger['info'](_0x8036('0x28'),_0x5e3879);logger[_0x8036('0x14')](_0x8036('0x28'),_0x5e3879,JSON[_0x8036('0x15')](_0x484b2c));_0x54035d(_0x484b2c);})[_0x8036('0x1a')](function(_0x421720){logger[_0x8036('0x16')](_0x8036('0x28'),_0x421720['message'],_0x5e3879);_0x10bdb6(_this[_0x8036('0x16')](0x1f4,_0x421720[_0x8036('0x18')]));});});};
\ No newline at end of file