Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index b6e7ee0..02ba243 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14f1=['ids','omit','spread','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','WhatsappInteraction','update','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find','body'];(function(_0x4f57c8,_0x32dc16){var _0x42fbf5=function(_0x42a240){while(--_0x42a240){_0x4f57c8['push'](_0x4f57c8['shift']());}};_0x42fbf5(++_0x32dc16);}(_0x14f1,0xcc));var _0x114f=function(_0x50a790,_0x851f4b){_0x50a790=_0x50a790-0x0;var _0x4833a3=_0x14f1[_0x50a790];return _0x4833a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x114f('0x0'));var BPromise=require(_0x114f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x114f('0x2'));var db=require(_0x114f('0x3'))['db'];var utils=require(_0x114f('0x4'));var logger=require('../../config/logger')(_0x114f('0x5'));var config=require(_0x114f('0x6'));var jayson=require(_0x114f('0x7'));var client=jayson[_0x114f('0x8')][_0x114f('0x9')]({'port':0x232a});config[_0x114f('0xa')]=_['defaults'](config['redis'],{'host':_0x114f('0xb'),'port':0x18eb});var socket=require(_0x114f('0xc'))(new Redis(config[_0x114f('0xa')]));require(_0x114f('0xd'))['register'](socket);function respondWithRpcPromise(_0x2151e2,_0x50ae7c,_0x39a69a){return new BPromise(function(_0x4a5907,_0x491ea7){return client[_0x114f('0xe')](_0x2151e2,_0x39a69a)[_0x114f('0xf')](function(_0xf8feee){logger[_0x114f('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x50ae7c,_0x114f('0x11'));logger[_0x114f('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x50ae7c,'request\x20sent',JSON['stringify'](_0xf8feee));if(_0xf8feee[_0x114f('0x13')]){if(_0xf8feee[_0x114f('0x13')]['code']===0x1f4){logger[_0x114f('0x13')](_0x114f('0x14'),_0x50ae7c,_0xf8feee[_0x114f('0x13')][_0x114f('0x15')]);return _0x491ea7(_0xf8feee[_0x114f('0x13')]['message']);}logger[_0x114f('0x13')](_0x114f('0x14'),_0x50ae7c,_0xf8feee['error'][_0x114f('0x15')]);return _0x4a5907(_0xf8feee[_0x114f('0x13')]['message']);}else{logger[_0x114f('0x10')](_0x114f('0x14'),_0x50ae7c,_0x114f('0x11'));_0x4a5907(_0xf8feee[_0x114f('0x16')][_0x114f('0x15')]);}})[_0x114f('0x17')](function(_0x42392a){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x50ae7c,_0x42392a);_0x491ea7(_0x42392a);});});}exports['UpdateWhatsappInteraction']=function(_0x3ddd1b){var _0x2c3156=this;return new Promise(function(_0x15b0c7,_0x4062dd){return db[_0x114f('0x18')][_0x114f('0x19')](_0x3ddd1b['body'],{'raw':_0x3ddd1b[_0x114f('0x1a')]?_0x3ddd1b['options'][_0x114f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ddd1b[_0x114f('0x1a')]?_0x3ddd1b[_0x114f('0x1a')][_0x114f('0x1c')]||null:null,'attributes':_0x3ddd1b[_0x114f('0x1a')]?_0x3ddd1b['options'][_0x114f('0x1d')]||null:null,'limit':_0x3ddd1b[_0x114f('0x1a')]?_0x3ddd1b['options'][_0x114f('0x1e')]||null:null})[_0x114f('0xf')](function(_0x30f08a){logger['info']('UpdateWhatsappInteraction',_0x3ddd1b);logger[_0x114f('0x12')](_0x114f('0x1f'),_0x3ddd1b,JSON[_0x114f('0x20')](_0x30f08a));_0x15b0c7(_0x30f08a);})[_0x114f('0x17')](function(_0x9f3f54){logger[_0x114f('0x13')](_0x114f('0x1f'),_0x9f3f54[_0x114f('0x15')],_0x3ddd1b);_0x4062dd(_0x2c3156[_0x114f('0x13')](0x1f4,_0x9f3f54[_0x114f('0x15')]));});});};exports[_0x114f('0x21')]=function(_0x82ea37){return new Promise(function(_0x4cb8b4,_0x4d69c){return db[_0x114f('0x18')][_0x114f('0x22')]({'where':_0x82ea37[_0x114f('0x1a')]?_0x82ea37['options'][_0x114f('0x1c')]||null:null})[_0x114f('0xf')](function(_0x532ccb){if(_0x532ccb){return _0x532ccb['addTags'](_0x82ea37[_0x114f('0x23')][_0x114f('0x24')],_[_0x114f('0x25')](_0x82ea37[_0x114f('0x23')],[_0x114f('0x24'),'id'])||{});}})[_0x114f('0x26')](function(_0x5e7167){logger['info'](_0x114f('0x27'),_0x82ea37);logger['debug'](_0x114f('0x27'),_0x82ea37,JSON[_0x114f('0x20')](_0x5e7167));_0x4cb8b4(_0x5e7167);})[_0x114f('0x17')](function(_0x423cc3){logger[_0x114f('0x13')](_0x114f('0x27'),_0x423cc3[_0x114f('0x15')],_0x82ea37);_0x4d69c(_this['error'](0x1f4,_0x423cc3[_0x114f('0x15')]));});});};
\ No newline at end of file
+var _0x2c06=['options','raw','where','attributes','limit','then','find','addTags','body','ids','omit','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x2c06,0xc5));var _0x62c0=function(_0x712717,_0xe8a2b9){_0x712717=_0x712717-0x0;var _0x37378f=_0x2c06[_0x712717];return _0x37378f;};'use strict';var _=require('lodash');var util=require(_0x62c0('0x0'));var moment=require(_0x62c0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62c0('0x2'))['db'];var utils=require(_0x62c0('0x3'));var logger=require(_0x62c0('0x4'))(_0x62c0('0x5'));var config=require(_0x62c0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x62c0('0x7')]=_['defaults'](config['redis'],{'host':_0x62c0('0x8'),'port':0x18eb});var socket=require(_0x62c0('0x9'))(new Redis(config['redis']));require(_0x62c0('0xa'))[_0x62c0('0xb')](socket);function respondWithRpcPromise(_0x1edda6,_0x3c8646,_0x4185b4){return new BPromise(function(_0x802262,_0x3f5922){return client['request'](_0x1edda6,_0x4185b4)['then'](function(_0x55c84c){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3c8646,_0x62c0('0xc'));logger[_0x62c0('0xd')](_0x62c0('0xe'),_0x3c8646,'request\x20sent',JSON[_0x62c0('0xf')](_0x55c84c));if(_0x55c84c['error']){if(_0x55c84c[_0x62c0('0x10')]['code']===0x1f4){logger[_0x62c0('0x10')](_0x62c0('0x11'),_0x3c8646,_0x55c84c[_0x62c0('0x10')]['message']);return _0x3f5922(_0x55c84c[_0x62c0('0x10')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3c8646,_0x55c84c[_0x62c0('0x10')]['message']);return _0x802262(_0x55c84c[_0x62c0('0x10')][_0x62c0('0x12')]);}else{logger[_0x62c0('0x13')](_0x62c0('0x11'),_0x3c8646,_0x62c0('0xc'));_0x802262(_0x55c84c[_0x62c0('0x14')]['message']);}})[_0x62c0('0x15')](function(_0x3cc616){logger[_0x62c0('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c8646,_0x3cc616);_0x3f5922(_0x3cc616);});});}exports[_0x62c0('0x16')]=function(_0x432951){var _0x5d9a3a=this;return new Promise(function(_0x50b66c,_0x517326){return db[_0x62c0('0x17')][_0x62c0('0x18')](_0x432951['body'],{'raw':_0x432951[_0x62c0('0x19')]?_0x432951['options'][_0x62c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x432951['options']?_0x432951[_0x62c0('0x19')][_0x62c0('0x1b')]||null:null,'attributes':_0x432951[_0x62c0('0x19')]?_0x432951[_0x62c0('0x19')][_0x62c0('0x1c')]||null:null,'limit':_0x432951[_0x62c0('0x19')]?_0x432951[_0x62c0('0x19')][_0x62c0('0x1d')]||null:null})[_0x62c0('0x1e')](function(_0xbf9e30){logger[_0x62c0('0x13')](_0x62c0('0x16'),_0x432951);logger[_0x62c0('0xd')](_0x62c0('0x16'),_0x432951,JSON['stringify'](_0xbf9e30));_0x50b66c(_0xbf9e30);})[_0x62c0('0x15')](function(_0x48ef06){logger[_0x62c0('0x10')](_0x62c0('0x16'),_0x48ef06['message'],_0x432951);_0x517326(_0x5d9a3a[_0x62c0('0x10')](0x1f4,_0x48ef06[_0x62c0('0x12')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3b4a34){return new Promise(function(_0x4b5406,_0x17e53f){return db[_0x62c0('0x17')][_0x62c0('0x1f')]({'where':_0x3b4a34[_0x62c0('0x19')]?_0x3b4a34['options'][_0x62c0('0x1b')]||null:null})[_0x62c0('0x1e')](function(_0xd5e0dd){if(_0xd5e0dd){return _0xd5e0dd[_0x62c0('0x20')](_0x3b4a34[_0x62c0('0x21')][_0x62c0('0x22')],_[_0x62c0('0x23')](_0x3b4a34['body'],[_0x62c0('0x22'),'id'])||{});}})['spread'](function(_0x2af8b2){logger[_0x62c0('0x13')]('AddTags',_0x3b4a34);logger[_0x62c0('0xd')](_0x62c0('0x24'),_0x3b4a34,JSON[_0x62c0('0xf')](_0x2af8b2));_0x4b5406(_0x2af8b2);})['catch'](function(_0x388c9c){logger[_0x62c0('0x10')]('AddTags',_0x388c9c[_0x62c0('0x12')],_0x3b4a34);_0x17e53f(_this[_0x62c0('0x10')](0x1f4,_0x388c9c[_0x62c0('0x12')]));});});};
\ No newline at end of file