Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 54b75fe..e147422 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1646=['stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','then','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x11bce8,_0x5c776f){var _0x2bd9d4=function(_0x49a102){while(--_0x49a102){_0x11bce8['push'](_0x11bce8['shift']());}};_0x2bd9d4(++_0x5c776f);}(_0x1646,0x105));var _0x6164=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x1646[_0x4ca333];return _0x13b2e1;};'use strict';var _=require('lodash');var util=require(_0x6164('0x0'));var moment=require('moment');var BPromise=require(_0x6164('0x1'));var rs=require(_0x6164('0x2'));var fs=require('fs');var Redis=require(_0x6164('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6164('0x4'));var logger=require(_0x6164('0x5'))(_0x6164('0x6'));var config=require(_0x6164('0x7'));var jayson=require(_0x6164('0x8'));var client=jayson[_0x6164('0x9')][_0x6164('0xa')]({'port':0x232a});config[_0x6164('0xb')]=_['defaults'](config['redis'],{'host':_0x6164('0xc'),'port':0x18eb});var socket=require(_0x6164('0xd'))(new Redis(config[_0x6164('0xb')]));require(_0x6164('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d1cbb,_0x4a958a,_0x5d2be3){return new BPromise(function(_0x4dd191,_0x2f121a){return client['request'](_0x5d1cbb,_0x5d2be3)['then'](function(_0x1e20de){logger[_0x6164('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x4a958a,'request\x20sent');logger[_0x6164('0x10')](_0x6164('0x11'),_0x4a958a,_0x6164('0x12'),JSON[_0x6164('0x13')](_0x1e20de));if(_0x1e20de[_0x6164('0x14')]){if(_0x1e20de[_0x6164('0x14')][_0x6164('0x15')]===0x1f4){logger['error'](_0x6164('0x16'),_0x4a958a,_0x1e20de[_0x6164('0x14')]['message']);return _0x2f121a(_0x1e20de[_0x6164('0x14')][_0x6164('0x17')]);}logger['error'](_0x6164('0x16'),_0x4a958a,_0x1e20de['error'][_0x6164('0x17')]);return _0x4dd191(_0x1e20de[_0x6164('0x14')][_0x6164('0x17')]);}else{logger[_0x6164('0xf')](_0x6164('0x16'),_0x4a958a,_0x6164('0x12'));_0x4dd191(_0x1e20de[_0x6164('0x18')][_0x6164('0x17')]);}})[_0x6164('0x19')](function(_0x861b1d){logger[_0x6164('0x14')](_0x6164('0x16'),_0x4a958a,_0x861b1d);_0x2f121a(_0x861b1d);});});}exports[_0x6164('0x1a')]=function(_0x42f79d){var _0x39887c=this;return new Promise(function(_0x46942f,_0x55b18d){return db['WhatsappInteraction'][_0x6164('0x1b')](_0x42f79d[_0x6164('0x1c')],{'raw':_0x42f79d[_0x6164('0x1d')]?_0x42f79d['options'][_0x6164('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f79d[_0x6164('0x1d')]?_0x42f79d[_0x6164('0x1d')][_0x6164('0x1f')]||null:null,'attributes':_0x42f79d[_0x6164('0x1d')]?_0x42f79d[_0x6164('0x1d')]['attributes']||null:null,'limit':_0x42f79d['options']?_0x42f79d[_0x6164('0x1d')]['limit']||null:null})[_0x6164('0x20')](function(_0x311479){logger[_0x6164('0xf')](_0x6164('0x1a'),_0x42f79d);logger['debug'](_0x6164('0x1a'),_0x42f79d,JSON[_0x6164('0x13')](_0x311479));_0x46942f(_0x311479);})[_0x6164('0x19')](function(_0x17f16f){logger['error'](_0x6164('0x1a'),_0x17f16f['message'],_0x42f79d);_0x55b18d(_0x39887c[_0x6164('0x14')](0x1f4,_0x17f16f[_0x6164('0x17')]));});});};exports[_0x6164('0x21')]=function(_0x1cdcfb){return new Promise(function(_0x10e819,_0x23e6e1){return db['WhatsappInteraction'][_0x6164('0x22')]({'where':_0x1cdcfb['options']?_0x1cdcfb[_0x6164('0x1d')][_0x6164('0x1f')]||null:null})['then'](function(_0x332709){if(_0x332709){return _0x332709[_0x6164('0x23')](_0x1cdcfb['body']['ids'],_[_0x6164('0x24')](_0x1cdcfb[_0x6164('0x1c')],[_0x6164('0x25'),'id'])||{});}})[_0x6164('0x26')](function(_0x4e2266){logger[_0x6164('0xf')](_0x6164('0x27'),_0x1cdcfb);logger[_0x6164('0x10')](_0x6164('0x27'),_0x1cdcfb,JSON['stringify'](_0x4e2266));_0x10e819(_0x4e2266);})[_0x6164('0x19')](function(_0x28629b){logger[_0x6164('0x14')](_0x6164('0x27'),_0x28629b[_0x6164('0x17')],_0x1cdcfb);_0x23e6e1(_this['error'](0x1f4,_0x28629b[_0x6164('0x17')]));});});};
\ No newline at end of file
+var _0xa27e=['register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','then','AddTagsToWhatsappInteraction','find','ids','omit','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter'];(function(_0x138071,_0x37b154){var _0x4757e2=function(_0x192f76){while(--_0x192f76){_0x138071['push'](_0x138071['shift']());}};_0x4757e2(++_0x37b154);}(_0xa27e,0x89));var _0xea27=function(_0x52c399,_0x30bc7c){_0x52c399=_0x52c399-0x0;var _0x3a53a0=_0xa27e[_0x52c399];return _0x3a53a0;};'use strict';var _=require('lodash');var util=require(_0xea27('0x0'));var moment=require('moment');var BPromise=require(_0xea27('0x1'));var rs=require(_0xea27('0x2'));var fs=require('fs');var Redis=require(_0xea27('0x3'));var db=require(_0xea27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea27('0x5'))('rpc');var config=require(_0xea27('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xea27('0x7')]['http']({'port':0x232a});config[_0xea27('0x8')]=_['defaults'](config[_0xea27('0x8')],{'host':_0xea27('0x9'),'port':0x18eb});var socket=require(_0xea27('0xa'))(new Redis(config[_0xea27('0x8')]));require('./whatsappInteraction.socket')[_0xea27('0xb')](socket);function respondWithRpcPromise(_0x47963,_0x1ca519,_0x1decba){return new BPromise(function(_0x7c2d5a,_0xcede50){return client[_0xea27('0xc')](_0x47963,_0x1decba)['then'](function(_0x21bd3a){logger[_0xea27('0xd')](_0xea27('0xe'),_0x1ca519,_0xea27('0xf'));logger[_0xea27('0x10')](_0xea27('0x11'),_0x1ca519,_0xea27('0xf'),JSON[_0xea27('0x12')](_0x21bd3a));if(_0x21bd3a[_0xea27('0x13')]){if(_0x21bd3a['error'][_0xea27('0x14')]===0x1f4){logger[_0xea27('0x13')](_0xea27('0xe'),_0x1ca519,_0x21bd3a[_0xea27('0x13')][_0xea27('0x15')]);return _0xcede50(_0x21bd3a[_0xea27('0x13')][_0xea27('0x15')]);}logger['error'](_0xea27('0xe'),_0x1ca519,_0x21bd3a[_0xea27('0x13')][_0xea27('0x15')]);return _0x7c2d5a(_0x21bd3a['error']['message']);}else{logger['info'](_0xea27('0xe'),_0x1ca519,_0xea27('0xf'));_0x7c2d5a(_0x21bd3a[_0xea27('0x16')][_0xea27('0x15')]);}})[_0xea27('0x17')](function(_0x494427){logger[_0xea27('0x13')](_0xea27('0xe'),_0x1ca519,_0x494427);_0xcede50(_0x494427);});});}exports[_0xea27('0x18')]=function(_0x1ce95f){var _0x347e70=this;return new Promise(function(_0x564942,_0x2cff77){return db[_0xea27('0x19')][_0xea27('0x1a')](_0x1ce95f[_0xea27('0x1b')],{'raw':_0x1ce95f[_0xea27('0x1c')]?_0x1ce95f[_0xea27('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce95f[_0xea27('0x1c')]?_0x1ce95f[_0xea27('0x1c')][_0xea27('0x1d')]||null:null,'attributes':_0x1ce95f[_0xea27('0x1c')]?_0x1ce95f[_0xea27('0x1c')][_0xea27('0x1e')]||null:null,'limit':_0x1ce95f[_0xea27('0x1c')]?_0x1ce95f[_0xea27('0x1c')]['limit']||null:null})[_0xea27('0x1f')](function(_0x421c3f){logger[_0xea27('0xd')](_0xea27('0x18'),_0x1ce95f);logger['debug']('UpdateWhatsappInteraction',_0x1ce95f,JSON[_0xea27('0x12')](_0x421c3f));_0x564942(_0x421c3f);})[_0xea27('0x17')](function(_0xc909a3){logger['error'](_0xea27('0x18'),_0xc909a3[_0xea27('0x15')],_0x1ce95f);_0x2cff77(_0x347e70[_0xea27('0x13')](0x1f4,_0xc909a3[_0xea27('0x15')]));});});};exports[_0xea27('0x20')]=function(_0x381c1e){return new Promise(function(_0x55510c,_0x3fe3a1){return db[_0xea27('0x19')][_0xea27('0x21')]({'where':_0x381c1e[_0xea27('0x1c')]?_0x381c1e[_0xea27('0x1c')][_0xea27('0x1d')]||null:null})[_0xea27('0x1f')](function(_0x3efebc){if(_0x3efebc){return _0x3efebc['addTags'](_0x381c1e[_0xea27('0x1b')][_0xea27('0x22')],_[_0xea27('0x23')](_0x381c1e['body'],['ids','id'])||{});}})['spread'](function(_0x18cde2){logger[_0xea27('0xd')]('AddTags',_0x381c1e);logger[_0xea27('0x10')](_0xea27('0x24'),_0x381c1e,JSON['stringify'](_0x18cde2));_0x55510c(_0x18cde2);})['catch'](function(_0x379747){logger[_0xea27('0x13')](_0xea27('0x24'),_0x379747[_0xea27('0x15')],_0x381c1e);_0x3fe3a1(_this[_0xea27('0x13')](0x1f4,_0x379747[_0xea27('0x15')]));});});};
\ No newline at end of file