Built motion from commit 9e1ec266.|2.6.28
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index c2670a8..a24bc1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1405=['error','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','info','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','debug','stringify'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x1405,0x1e9));var _0x5140=function(_0x2e9da2,_0x25c4b3){_0x2e9da2=_0x2e9da2-0x0;var _0x5da8ea=_0x1405[_0x2e9da2];return _0x5da8ea;};'use strict';var _=require(_0x5140('0x0'));var util=require(_0x5140('0x1'));var moment=require('moment');var BPromise=require(_0x5140('0x2'));var rs=require(_0x5140('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5140('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5140('0x5'))('rpc');var config=require(_0x5140('0x6'));var jayson=require(_0x5140('0x7'));var client=jayson[_0x5140('0x8')][_0x5140('0x9')]({'port':0x232a});config[_0x5140('0xa')]=_['defaults'](config['redis'],{'host':_0x5140('0xb'),'port':0x18eb});var socket=require(_0x5140('0xc'))(new Redis(config[_0x5140('0xa')]));require(_0x5140('0xd'))['register'](socket);function respondWithRpcPromise(_0xe3d22,_0x14cac4,_0x42a03f){return new BPromise(function(_0xf03e3,_0x5c5f8c){return client[_0x5140('0xe')](_0xe3d22,_0x42a03f)[_0x5140('0xf')](function(_0x3ea638){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x14cac4,'request\x20sent');logger[_0x5140('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x14cac4,'request\x20sent',JSON[_0x5140('0x11')](_0x3ea638));if(_0x3ea638[_0x5140('0x12')]){if(_0x3ea638[_0x5140('0x12')]['code']===0x1f4){logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0x3ea638['error'][_0x5140('0x14')]);return _0x5c5f8c(_0x3ea638[_0x5140('0x12')]['message']);}logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0x3ea638[_0x5140('0x12')][_0x5140('0x14')]);return _0xf03e3(_0x3ea638[_0x5140('0x12')][_0x5140('0x14')]);}else{logger['info'](_0x5140('0x13'),_0x14cac4,_0x5140('0x15'));_0xf03e3(_0x3ea638[_0x5140('0x16')][_0x5140('0x14')]);}})[_0x5140('0x17')](function(_0xe007d9){logger[_0x5140('0x12')](_0x5140('0x13'),_0x14cac4,_0xe007d9);_0x5c5f8c(_0xe007d9);});});}exports[_0x5140('0x18')]=function(_0x147894){var _0x5e9dee=this;return new Promise(function(_0xd16c24,_0x12e553){return db[_0x5140('0x19')][_0x5140('0x1a')](_0x147894[_0x5140('0x1b')],{'raw':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')][_0x5140('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147894[_0x5140('0x1c')]?_0x147894['options'][_0x5140('0x1e')]||null:null,'attributes':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')]['attributes']||null:null,'limit':_0x147894[_0x5140('0x1c')]?_0x147894[_0x5140('0x1c')][_0x5140('0x1f')]||null:null})[_0x5140('0xf')](function(_0x5a174e){logger['info'](_0x5140('0x18'),_0x147894);logger[_0x5140('0x10')](_0x5140('0x18'),_0x147894,JSON[_0x5140('0x11')](_0x5a174e));_0xd16c24(_0x5a174e);})[_0x5140('0x17')](function(_0x1dfe18){logger[_0x5140('0x12')]('UpdateWhatsappInteraction',_0x1dfe18[_0x5140('0x14')],_0x147894);_0x12e553(_0x5e9dee[_0x5140('0x12')](0x1f4,_0x1dfe18['message']));});});};exports[_0x5140('0x20')]=function(_0xf95b85){return new Promise(function(_0x50cba0,_0x37eaf7){return db[_0x5140('0x19')][_0x5140('0x21')]({'where':_0xf95b85['options']?_0xf95b85[_0x5140('0x1c')][_0x5140('0x1e')]||null:null})[_0x5140('0xf')](function(_0x54ffe1){if(_0x54ffe1){return _0x54ffe1['addTags'](_0xf95b85[_0x5140('0x1b')][_0x5140('0x22')],_[_0x5140('0x23')](_0xf95b85[_0x5140('0x1b')],[_0x5140('0x22'),'id'])||{});}})[_0x5140('0x24')](function(_0x4f99f8){logger[_0x5140('0x25')](_0x5140('0x26'),_0xf95b85);logger[_0x5140('0x10')](_0x5140('0x26'),_0xf95b85,JSON['stringify'](_0x4f99f8));_0x50cba0(_0x4f99f8);})[_0x5140('0x17')](function(_0x541f4a){logger[_0x5140('0x12')](_0x5140('0x26'),_0x541f4a[_0x5140('0x14')],_0xf95b85);_0x37eaf7(_this[_0x5140('0x12')](0x1f4,_0x541f4a[_0x5140('0x14')]));});});};
\ No newline at end of file
+var _0xfc9b=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','catch','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b7e18,_0xb04a03){var _0x2a48cd=function(_0x137c08){while(--_0x137c08){_0x3b7e18['push'](_0x3b7e18['shift']());}};_0x2a48cd(++_0xb04a03);}(_0xfc9b,0x126));var _0xbfc9=function(_0x22ce25,_0x307747){_0x22ce25=_0x22ce25-0x0;var _0x3bd9c6=_0xfc9b[_0x22ce25];return _0x3bd9c6;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var moment=require(_0xbfc9('0x2'));var BPromise=require(_0xbfc9('0x3'));var rs=require(_0xbfc9('0x4'));var fs=require('fs');var Redis=require(_0xbfc9('0x5'));var db=require(_0xbfc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfc9('0x7'))(_0xbfc9('0x8'));var config=require(_0xbfc9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbfc9('0xa')][_0xbfc9('0xb')]({'port':0x232a});config[_0xbfc9('0xc')]=_[_0xbfc9('0xd')](config['redis'],{'host':_0xbfc9('0xe'),'port':0x18eb});var socket=require(_0xbfc9('0xf'))(new Redis(config['redis']));require(_0xbfc9('0x10'))[_0xbfc9('0x11')](socket);function respondWithRpcPromise(_0x459fa2,_0x5bcd9a,_0x1823b1){return new BPromise(function(_0x31d328,_0x12a420){return client['request'](_0x459fa2,_0x1823b1)[_0xbfc9('0x12')](function(_0x572c75){logger[_0xbfc9('0x13')](_0xbfc9('0x14'),_0x5bcd9a,'request\x20sent');logger[_0xbfc9('0x15')](_0xbfc9('0x16'),_0x5bcd9a,_0xbfc9('0x17'),JSON[_0xbfc9('0x18')](_0x572c75));if(_0x572c75['error']){if(_0x572c75[_0xbfc9('0x19')]['code']===0x1f4){logger[_0xbfc9('0x19')](_0xbfc9('0x14'),_0x5bcd9a,_0x572c75[_0xbfc9('0x19')][_0xbfc9('0x1a')]);return _0x12a420(_0x572c75['error'][_0xbfc9('0x1a')]);}logger[_0xbfc9('0x19')](_0xbfc9('0x14'),_0x5bcd9a,_0x572c75[_0xbfc9('0x19')][_0xbfc9('0x1a')]);return _0x31d328(_0x572c75['error'][_0xbfc9('0x1a')]);}else{logger[_0xbfc9('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x5bcd9a,'request\x20sent');_0x31d328(_0x572c75[_0xbfc9('0x1b')][_0xbfc9('0x1a')]);}})['catch'](function(_0x2ed064){logger[_0xbfc9('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x5bcd9a,_0x2ed064);_0x12a420(_0x2ed064);});});}exports[_0xbfc9('0x1c')]=function(_0x15aa26){var _0x209b12=this;return new Promise(function(_0x581468,_0x284b49){return db[_0xbfc9('0x1d')][_0xbfc9('0x1e')](_0x15aa26[_0xbfc9('0x1f')],{'raw':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26['options'][_0xbfc9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26['options'][_0xbfc9('0x22')]||null:null,'attributes':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26[_0xbfc9('0x20')][_0xbfc9('0x23')]||null:null,'limit':_0x15aa26[_0xbfc9('0x20')]?_0x15aa26[_0xbfc9('0x20')][_0xbfc9('0x24')]||null:null})[_0xbfc9('0x12')](function(_0x39f71d){logger[_0xbfc9('0x13')]('UpdateWhatsappInteraction',_0x15aa26);logger['debug']('UpdateWhatsappInteraction',_0x15aa26,JSON[_0xbfc9('0x18')](_0x39f71d));_0x581468(_0x39f71d);})[_0xbfc9('0x25')](function(_0x37c47e){logger[_0xbfc9('0x19')](_0xbfc9('0x1c'),_0x37c47e[_0xbfc9('0x1a')],_0x15aa26);_0x284b49(_0x209b12[_0xbfc9('0x19')](0x1f4,_0x37c47e['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2bf623){return new Promise(function(_0x39d1a0,_0x4a61e9){return db['WhatsappInteraction'][_0xbfc9('0x26')]({'where':_0x2bf623[_0xbfc9('0x20')]?_0x2bf623[_0xbfc9('0x20')]['where']||null:null})[_0xbfc9('0x12')](function(_0x5a5810){if(_0x5a5810){return _0x5a5810[_0xbfc9('0x27')](_0x2bf623[_0xbfc9('0x1f')][_0xbfc9('0x28')],_['omit'](_0x2bf623[_0xbfc9('0x1f')],[_0xbfc9('0x28'),'id'])||{});}})[_0xbfc9('0x29')](function(_0x18533a){logger['info'](_0xbfc9('0x2a'),_0x2bf623);logger[_0xbfc9('0x15')](_0xbfc9('0x2a'),_0x2bf623,JSON[_0xbfc9('0x18')](_0x18533a));_0x39d1a0(_0x18533a);})[_0xbfc9('0x25')](function(_0x9edd8c){logger[_0xbfc9('0x19')](_0xbfc9('0x2a'),_0x9edd8c[_0xbfc9('0x1a')],_0x2bf623);_0x4a61e9(_this[_0xbfc9('0x19')](0x1f4,_0x9edd8c[_0xbfc9('0x1a')]));});});};
\ No newline at end of file