Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 32e461f..f2e1638 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3765=['message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s'];(function(_0xb6bddf,_0x2372c3){var _0x1a7749=function(_0x3e020e){while(--_0x3e020e){_0xb6bddf['push'](_0xb6bddf['shift']());}};_0x1a7749(++_0x2372c3);}(_0x3765,0x90));var _0x5376=function(_0x120280,_0x383837){_0x120280=_0x120280-0x0;var _0x4022ed=_0x3765[_0x120280];return _0x4022ed;};'use strict';var _=require(_0x5376('0x0'));var util=require('util');var moment=require(_0x5376('0x1'));var BPromise=require(_0x5376('0x2'));var rs=require(_0x5376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5376('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5376('0x5'))(_0x5376('0x6'));var config=require('../../config/environment');var jayson=require(_0x5376('0x7'));var client=jayson[_0x5376('0x8')][_0x5376('0x9')]({'port':0x232a});config[_0x5376('0xa')]=_[_0x5376('0xb')](config[_0x5376('0xa')],{'host':_0x5376('0xc'),'port':0x18eb});var socket=require(_0x5376('0xd'))(new Redis(config[_0x5376('0xa')]));require('./whatsappInteraction.socket')[_0x5376('0xe')](socket);function respondWithRpcPromise(_0x4ed29e,_0x409c58,_0x4a438d){return new BPromise(function(_0x53c967,_0x24bf70){return client['request'](_0x4ed29e,_0x4a438d)[_0x5376('0xf')](function(_0x1bb3d8){logger[_0x5376('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x409c58,'request\x20sent');logger[_0x5376('0x11')](_0x5376('0x12'),_0x409c58,_0x5376('0x13'),JSON[_0x5376('0x14')](_0x1bb3d8));if(_0x1bb3d8[_0x5376('0x15')]){if(_0x1bb3d8['error'][_0x5376('0x16')]===0x1f4){logger[_0x5376('0x15')](_0x5376('0x17'),_0x409c58,_0x1bb3d8['error'][_0x5376('0x18')]);return _0x24bf70(_0x1bb3d8[_0x5376('0x15')][_0x5376('0x18')]);}logger[_0x5376('0x15')](_0x5376('0x17'),_0x409c58,_0x1bb3d8[_0x5376('0x15')]['message']);return _0x53c967(_0x1bb3d8[_0x5376('0x15')][_0x5376('0x18')]);}else{logger[_0x5376('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x409c58,_0x5376('0x13'));_0x53c967(_0x1bb3d8[_0x5376('0x19')][_0x5376('0x18')]);}})[_0x5376('0x1a')](function(_0x503edb){logger[_0x5376('0x15')](_0x5376('0x17'),_0x409c58,_0x503edb);_0x24bf70(_0x503edb);});});}exports[_0x5376('0x1b')]=function(_0x22e8c4){var _0x1b9071=this;return new Promise(function(_0x2fc828,_0x29289b){return db[_0x5376('0x1c')][_0x5376('0x1d')](_0x22e8c4['body'],{'raw':_0x22e8c4[_0x5376('0x1e')]?_0x22e8c4[_0x5376('0x1e')][_0x5376('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22e8c4[_0x5376('0x1e')]?_0x22e8c4[_0x5376('0x1e')]['where']||null:null,'attributes':_0x22e8c4[_0x5376('0x1e')]?_0x22e8c4['options'][_0x5376('0x20')]||null:null,'limit':_0x22e8c4[_0x5376('0x1e')]?_0x22e8c4[_0x5376('0x1e')][_0x5376('0x21')]||null:null})[_0x5376('0xf')](function(_0x2d4a5f){logger[_0x5376('0x10')](_0x5376('0x1b'),_0x22e8c4);logger[_0x5376('0x11')](_0x5376('0x1b'),_0x22e8c4,JSON['stringify'](_0x2d4a5f));_0x2fc828(_0x2d4a5f);})[_0x5376('0x1a')](function(_0x37421a){logger[_0x5376('0x15')](_0x5376('0x1b'),_0x37421a['message'],_0x22e8c4);_0x29289b(_0x1b9071[_0x5376('0x15')](0x1f4,_0x37421a['message']));});});};exports[_0x5376('0x22')]=function(_0x31bfac){return new Promise(function(_0xf5c8ae,_0x12fcd1){return db['WhatsappInteraction'][_0x5376('0x23')]({'where':_0x31bfac[_0x5376('0x1e')]?_0x31bfac[_0x5376('0x1e')]['where']||null:null})['then'](function(_0x18b69b){if(_0x18b69b){return _0x18b69b[_0x5376('0x24')](_0x31bfac[_0x5376('0x25')]['ids'],_[_0x5376('0x26')](_0x31bfac['body'],[_0x5376('0x27'),'id'])||{});}})[_0x5376('0x28')](function(_0x35e96c){logger[_0x5376('0x10')]('AddTags',_0x31bfac);logger[_0x5376('0x11')](_0x5376('0x29'),_0x31bfac,JSON[_0x5376('0x14')](_0x35e96c));_0xf5c8ae(_0x35e96c);})[_0x5376('0x1a')](function(_0x233f9a){logger['error'](_0x5376('0x29'),_0x233f9a['message'],_0x31bfac);_0x12fcd1(_this[_0x5376('0x15')](0x1f4,_0x233f9a[_0x5376('0x18')]));});});};
\ No newline at end of file
+var _0x7961=['client','http','redis','localhost','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappInteraction','options','raw','where','attributes','UpdateWhatsappInteraction','stringify','find','addTags','omit','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26ca4e,_0x50ecc8){var _0xb31cd=function(_0x35b270){while(--_0x35b270){_0x26ca4e['push'](_0x26ca4e['shift']());}};_0xb31cd(++_0x50ecc8);}(_0x7961,0xe6));var _0x1796=function(_0x489df9,_0x5d63b8){_0x489df9=_0x489df9-0x0;var _0x1f2679=_0x7961[_0x489df9];return _0x1f2679;};'use strict';var _=require(_0x1796('0x0'));var util=require('util');var moment=require(_0x1796('0x1'));var BPromise=require(_0x1796('0x2'));var rs=require(_0x1796('0x3'));var fs=require('fs');var Redis=require(_0x1796('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1796('0x5'));var logger=require(_0x1796('0x6'))(_0x1796('0x7'));var config=require(_0x1796('0x8'));var jayson=require(_0x1796('0x9'));var client=jayson[_0x1796('0xa')][_0x1796('0xb')]({'port':0x232a});config[_0x1796('0xc')]=_['defaults'](config[_0x1796('0xc')],{'host':_0x1796('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1796('0xc')]));require('./whatsappInteraction.socket')[_0x1796('0xe')](socket);function respondWithRpcPromise(_0x3f699e,_0x2c5dd0,_0x2605f1){return new BPromise(function(_0xf1644,_0x347ff){return client[_0x1796('0xf')](_0x3f699e,_0x2605f1)[_0x1796('0x10')](function(_0xf162ed){logger[_0x1796('0x11')](_0x1796('0x12'),_0x2c5dd0,_0x1796('0x13'));logger[_0x1796('0x14')](_0x1796('0x15'),_0x2c5dd0,_0x1796('0x13'),JSON['stringify'](_0xf162ed));if(_0xf162ed[_0x1796('0x16')]){if(_0xf162ed[_0x1796('0x16')]['code']===0x1f4){logger[_0x1796('0x16')](_0x1796('0x12'),_0x2c5dd0,_0xf162ed['error']['message']);return _0x347ff(_0xf162ed[_0x1796('0x16')][_0x1796('0x17')]);}logger[_0x1796('0x16')](_0x1796('0x12'),_0x2c5dd0,_0xf162ed['error']['message']);return _0xf1644(_0xf162ed[_0x1796('0x16')][_0x1796('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x2c5dd0,_0x1796('0x13'));_0xf1644(_0xf162ed[_0x1796('0x18')]['message']);}})[_0x1796('0x19')](function(_0x3628a0){logger[_0x1796('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c5dd0,_0x3628a0);_0x347ff(_0x3628a0);});});}exports['UpdateWhatsappInteraction']=function(_0x28b590){var _0x1561b6=this;return new Promise(function(_0x2c9885,_0x632cea){return db[_0x1796('0x1a')]['update'](_0x28b590['body'],{'raw':_0x28b590[_0x1796('0x1b')]?_0x28b590[_0x1796('0x1b')][_0x1796('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b590[_0x1796('0x1b')]?_0x28b590[_0x1796('0x1b')][_0x1796('0x1d')]||null:null,'attributes':_0x28b590[_0x1796('0x1b')]?_0x28b590[_0x1796('0x1b')][_0x1796('0x1e')]||null:null,'limit':_0x28b590[_0x1796('0x1b')]?_0x28b590[_0x1796('0x1b')]['limit']||null:null})['then'](function(_0x3e0389){logger[_0x1796('0x11')](_0x1796('0x1f'),_0x28b590);logger[_0x1796('0x14')]('UpdateWhatsappInteraction',_0x28b590,JSON[_0x1796('0x20')](_0x3e0389));_0x2c9885(_0x3e0389);})['catch'](function(_0x28313b){logger[_0x1796('0x16')](_0x1796('0x1f'),_0x28313b[_0x1796('0x17')],_0x28b590);_0x632cea(_0x1561b6[_0x1796('0x16')](0x1f4,_0x28313b['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x46d447){return new Promise(function(_0x38cb1f,_0x503617){return db[_0x1796('0x1a')][_0x1796('0x21')]({'where':_0x46d447[_0x1796('0x1b')]?_0x46d447[_0x1796('0x1b')][_0x1796('0x1d')]||null:null})[_0x1796('0x10')](function(_0x16297a){if(_0x16297a){return _0x16297a[_0x1796('0x22')](_0x46d447['body']['ids'],_[_0x1796('0x23')](_0x46d447[_0x1796('0x24')],[_0x1796('0x25'),'id'])||{});}})[_0x1796('0x26')](function(_0x24082b){logger[_0x1796('0x11')](_0x1796('0x27'),_0x46d447);logger[_0x1796('0x14')]('AddTags',_0x46d447,JSON[_0x1796('0x20')](_0x24082b));_0x38cb1f(_0x24082b);})['catch'](function(_0x493c51){logger['error']('AddTags',_0x493c51['message'],_0x46d447);_0x503617(_this[_0x1796('0x16')](0x1f4,_0x493c51['message']));});});};
\ No newline at end of file