Built motion from commit c738b9ac.|2.6.25
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 6edf39a..b6e7ee0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98b6=['debug','stringify','error','code','message','info','request\x20sent','result','catch','WhatsappInteraction','update','options','where','attributes','limit','then','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','localhost','./whatsappInteraction.socket','register','request','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x98b6,0x130));var _0x698b=function(_0x43891f,_0x459095){_0x43891f=_0x43891f-0x0;var _0x3f15c6=_0x98b6[_0x43891f];return _0x3f15c6;};'use strict';var _=require(_0x698b('0x0'));var util=require(_0x698b('0x1'));var moment=require(_0x698b('0x2'));var BPromise=require(_0x698b('0x3'));var rs=require(_0x698b('0x4'));var fs=require('fs');var Redis=require(_0x698b('0x5'));var db=require(_0x698b('0x6'))['db'];var utils=require(_0x698b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x698b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x698b('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x698b('0xa')],{'host':_0x698b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x698b('0xa')]));require(_0x698b('0xc'))[_0x698b('0xd')](socket);function respondWithRpcPromise(_0xb7b979,_0x1efbf7,_0x37bef6){return new BPromise(function(_0x5e790d,_0xe12525){return client[_0x698b('0xe')](_0xb7b979,_0x37bef6)['then'](function(_0x1f20d0){logger['info'](_0x698b('0xf'),_0x1efbf7,'request\x20sent');logger[_0x698b('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1efbf7,'request\x20sent',JSON[_0x698b('0x11')](_0x1f20d0));if(_0x1f20d0[_0x698b('0x12')]){if(_0x1f20d0[_0x698b('0x12')][_0x698b('0x13')]===0x1f4){logger['error'](_0x698b('0xf'),_0x1efbf7,_0x1f20d0[_0x698b('0x12')][_0x698b('0x14')]);return _0xe12525(_0x1f20d0[_0x698b('0x12')][_0x698b('0x14')]);}logger[_0x698b('0x12')](_0x698b('0xf'),_0x1efbf7,_0x1f20d0[_0x698b('0x12')][_0x698b('0x14')]);return _0x5e790d(_0x1f20d0[_0x698b('0x12')][_0x698b('0x14')]);}else{logger[_0x698b('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x1efbf7,_0x698b('0x16'));_0x5e790d(_0x1f20d0[_0x698b('0x17')]['message']);}})[_0x698b('0x18')](function(_0x3827f3){logger['error'](_0x698b('0xf'),_0x1efbf7,_0x3827f3);_0xe12525(_0x3827f3);});});}exports['UpdateWhatsappInteraction']=function(_0x1fbe5a){var _0x1f676c=this;return new Promise(function(_0x35eff8,_0x11a13f){return db[_0x698b('0x19')][_0x698b('0x1a')](_0x1fbe5a['body'],{'raw':_0x1fbe5a[_0x698b('0x1b')]?_0x1fbe5a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbe5a['options']?_0x1fbe5a['options'][_0x698b('0x1c')]||null:null,'attributes':_0x1fbe5a[_0x698b('0x1b')]?_0x1fbe5a[_0x698b('0x1b')][_0x698b('0x1d')]||null:null,'limit':_0x1fbe5a[_0x698b('0x1b')]?_0x1fbe5a[_0x698b('0x1b')][_0x698b('0x1e')]||null:null})[_0x698b('0x1f')](function(_0x4c2537){logger['info'](_0x698b('0x20'),_0x1fbe5a);logger[_0x698b('0x10')](_0x698b('0x20'),_0x1fbe5a,JSON[_0x698b('0x11')](_0x4c2537));_0x35eff8(_0x4c2537);})[_0x698b('0x18')](function(_0x1bf9e8){logger['error']('UpdateWhatsappInteraction',_0x1bf9e8[_0x698b('0x14')],_0x1fbe5a);_0x11a13f(_0x1f676c['error'](0x1f4,_0x1bf9e8[_0x698b('0x14')]));});});};exports[_0x698b('0x21')]=function(_0x5c2b79){return new Promise(function(_0x57c9c9,_0x47f154){return db[_0x698b('0x19')][_0x698b('0x22')]({'where':_0x5c2b79['options']?_0x5c2b79[_0x698b('0x1b')][_0x698b('0x1c')]||null:null})[_0x698b('0x1f')](function(_0x5dde82){if(_0x5dde82){return _0x5dde82['addTags'](_0x5c2b79[_0x698b('0x23')][_0x698b('0x24')],_[_0x698b('0x25')](_0x5c2b79['body'],[_0x698b('0x24'),'id'])||{});}})[_0x698b('0x26')](function(_0x327f9f){logger[_0x698b('0x15')]('AddTags',_0x5c2b79);logger[_0x698b('0x10')](_0x698b('0x27'),_0x5c2b79,JSON[_0x698b('0x11')](_0x327f9f));_0x57c9c9(_0x327f9f);})['catch'](function(_0x1b27bd){logger[_0x698b('0x12')](_0x698b('0x27'),_0x1b27bd[_0x698b('0x14')],_0x5c2b79);_0x47f154(_this[_0x698b('0x12')](0x1f4,_0x1b27bd['message']));});});};
\ No newline at end of file
+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