Built motion from commit (unavailable).|2.5.17
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 293be5e..52fbb28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fdc=['redis','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateWhatsappInteraction','update','options','where','attributes','catch','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37df6c,_0x2a9666){var _0x41f7aa=function(_0x2c9605){while(--_0x2c9605){_0x37df6c['push'](_0x37df6c['shift']());}};_0x41f7aa(++_0x2a9666);}(_0x0fdc,0x1ef));var _0xc0fd=function(_0x2c8de4,_0x48ecd7){_0x2c8de4=_0x2c8de4-0x0;var _0xa5f1d5=_0x0fdc[_0x2c8de4];return _0xa5f1d5;};'use strict';var _=require(_0xc0fd('0x0'));var util=require(_0xc0fd('0x1'));var moment=require(_0xc0fd('0x2'));var BPromise=require(_0xc0fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0fd('0x4'));var db=require(_0xc0fd('0x5'))['db'];var utils=require(_0xc0fd('0x6'));var logger=require(_0xc0fd('0x7'))(_0xc0fd('0x8'));var config=require(_0xc0fd('0x9'));var jayson=require(_0xc0fd('0xa'));var client=jayson[_0xc0fd('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc0fd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0fd('0xc')]));require('./whatsappInteraction.socket')[_0xc0fd('0xd')](socket);function respondWithRpcPromise(_0x41dcd1,_0x52f266,_0x2f5f71){return new BPromise(function(_0x231f9d,_0x105315){return client[_0xc0fd('0xe')](_0x41dcd1,_0x2f5f71)[_0xc0fd('0xf')](function(_0x26650c){logger[_0xc0fd('0x10')](_0xc0fd('0x11'),_0x52f266,_0xc0fd('0x12'));logger[_0xc0fd('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x52f266,_0xc0fd('0x12'),JSON[_0xc0fd('0x14')](_0x26650c));if(_0x26650c[_0xc0fd('0x15')]){if(_0x26650c[_0xc0fd('0x15')][_0xc0fd('0x16')]===0x1f4){logger[_0xc0fd('0x15')](_0xc0fd('0x11'),_0x52f266,_0x26650c[_0xc0fd('0x15')]['message']);return _0x105315(_0x26650c[_0xc0fd('0x15')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x52f266,_0x26650c[_0xc0fd('0x15')][_0xc0fd('0x17')]);return _0x231f9d(_0x26650c['error']['message']);}else{logger[_0xc0fd('0x10')](_0xc0fd('0x11'),_0x52f266,_0xc0fd('0x12'));_0x231f9d(_0x26650c[_0xc0fd('0x18')][_0xc0fd('0x17')]);}})['catch'](function(_0x2ee666){logger[_0xc0fd('0x15')](_0xc0fd('0x11'),_0x52f266,_0x2ee666);_0x105315(_0x2ee666);});});}exports[_0xc0fd('0x19')]=function(_0x525af9){var _0x433291=this;return new Promise(function(_0x4b07c6,_0x362b73){return db['WhatsappInteraction'][_0xc0fd('0x1a')](_0x525af9['body'],{'raw':_0x525af9[_0xc0fd('0x1b')]?_0x525af9[_0xc0fd('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525af9[_0xc0fd('0x1b')]?_0x525af9[_0xc0fd('0x1b')][_0xc0fd('0x1c')]||null:null,'attributes':_0x525af9['options']?_0x525af9[_0xc0fd('0x1b')][_0xc0fd('0x1d')]||null:null,'limit':_0x525af9['options']?_0x525af9['options']['limit']||null:null})['then'](function(_0x70a18b){logger[_0xc0fd('0x10')](_0xc0fd('0x19'),_0x525af9);logger['debug'](_0xc0fd('0x19'),_0x525af9,JSON[_0xc0fd('0x14')](_0x70a18b));_0x4b07c6(_0x70a18b);})[_0xc0fd('0x1e')](function(_0x2de00b){logger[_0xc0fd('0x15')](_0xc0fd('0x19'),_0x2de00b['message'],_0x525af9);_0x362b73(_0x433291[_0xc0fd('0x15')](0x1f4,_0x2de00b[_0xc0fd('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x23b582){return new Promise(function(_0x4a4298,_0x508a3d){return db[_0xc0fd('0x1f')][_0xc0fd('0x20')]({'where':_0x23b582[_0xc0fd('0x1b')]?_0x23b582[_0xc0fd('0x1b')][_0xc0fd('0x1c')]||null:null})[_0xc0fd('0xf')](function(_0x3a0e1d){if(_0x3a0e1d){return _0x3a0e1d[_0xc0fd('0x21')](_0x23b582[_0xc0fd('0x22')][_0xc0fd('0x23')],_[_0xc0fd('0x24')](_0x23b582[_0xc0fd('0x22')],[_0xc0fd('0x23'),'id'])||{});}})[_0xc0fd('0x25')](function(_0x20f9dc){logger[_0xc0fd('0x10')](_0xc0fd('0x26'),_0x23b582);logger['debug']('AddTags',_0x23b582,JSON[_0xc0fd('0x14')](_0x20f9dc));_0x4a4298(_0x20f9dc);})['catch'](function(_0x47eb7b){logger[_0xc0fd('0x15')](_0xc0fd('0x26'),_0x47eb7b[_0xc0fd('0x17')],_0x23b582);_0x508a3d(_this[_0xc0fd('0x15')](0x1f4,_0x47eb7b[_0xc0fd('0x17')]));});});};
\ No newline at end of file
+var _0x6d2b=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','AddTags','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6d2b,0xfc));var _0xb6d2=function(_0x4d9cee,_0x2e1350){_0x4d9cee=_0x4d9cee-0x0;var _0x2fad5d=_0x6d2b[_0x4d9cee];return _0x2fad5d;};'use strict';var _=require(_0xb6d2('0x0'));var util=require('util');var moment=require(_0xb6d2('0x1'));var BPromise=require(_0xb6d2('0x2'));var rs=require(_0xb6d2('0x3'));var fs=require('fs');var Redis=require(_0xb6d2('0x4'));var db=require(_0xb6d2('0x5'))['db'];var utils=require(_0xb6d2('0x6'));var logger=require('../../config/logger')(_0xb6d2('0x7'));var config=require(_0xb6d2('0x8'));var jayson=require(_0xb6d2('0x9'));var client=jayson['client'][_0xb6d2('0xa')]({'port':0x232a});config[_0xb6d2('0xb')]=_[_0xb6d2('0xc')](config[_0xb6d2('0xb')],{'host':_0xb6d2('0xd'),'port':0x18eb});var socket=require(_0xb6d2('0xe'))(new Redis(config[_0xb6d2('0xb')]));require(_0xb6d2('0xf'))[_0xb6d2('0x10')](socket);function respondWithRpcPromise(_0x574224,_0x80adf6,_0x4a6785){return new BPromise(function(_0x1ee731,_0x591f56){return client[_0xb6d2('0x11')](_0x574224,_0x4a6785)[_0xb6d2('0x12')](function(_0x48e145){logger[_0xb6d2('0x13')](_0xb6d2('0x14'),_0x80adf6,_0xb6d2('0x15'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x80adf6,'request\x20sent',JSON['stringify'](_0x48e145));if(_0x48e145[_0xb6d2('0x16')]){if(_0x48e145[_0xb6d2('0x16')]['code']===0x1f4){logger[_0xb6d2('0x16')](_0xb6d2('0x14'),_0x80adf6,_0x48e145['error'][_0xb6d2('0x17')]);return _0x591f56(_0x48e145['error'][_0xb6d2('0x17')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x80adf6,_0x48e145['error'][_0xb6d2('0x17')]);return _0x1ee731(_0x48e145['error'][_0xb6d2('0x17')]);}else{logger[_0xb6d2('0x13')](_0xb6d2('0x14'),_0x80adf6,_0xb6d2('0x15'));_0x1ee731(_0x48e145[_0xb6d2('0x18')][_0xb6d2('0x17')]);}})['catch'](function(_0x178efc){logger[_0xb6d2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x80adf6,_0x178efc);_0x591f56(_0x178efc);});});}exports['UpdateWhatsappInteraction']=function(_0x39b189){var _0x53886d=this;return new Promise(function(_0x3e6b42,_0x45e4a3){return db['WhatsappInteraction'][_0xb6d2('0x19')](_0x39b189[_0xb6d2('0x1a')],{'raw':_0x39b189[_0xb6d2('0x1b')]?_0x39b189[_0xb6d2('0x1b')][_0xb6d2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b189[_0xb6d2('0x1b')]?_0x39b189['options'][_0xb6d2('0x1d')]||null:null,'attributes':_0x39b189['options']?_0x39b189[_0xb6d2('0x1b')][_0xb6d2('0x1e')]||null:null,'limit':_0x39b189[_0xb6d2('0x1b')]?_0x39b189['options'][_0xb6d2('0x1f')]||null:null})[_0xb6d2('0x12')](function(_0x43f3c6){logger['info'](_0xb6d2('0x20'),_0x39b189);logger['debug'](_0xb6d2('0x20'),_0x39b189,JSON[_0xb6d2('0x21')](_0x43f3c6));_0x3e6b42(_0x43f3c6);})['catch'](function(_0x46f37f){logger['error'](_0xb6d2('0x20'),_0x46f37f[_0xb6d2('0x17')],_0x39b189);_0x45e4a3(_0x53886d[_0xb6d2('0x16')](0x1f4,_0x46f37f[_0xb6d2('0x17')]));});});};exports[_0xb6d2('0x22')]=function(_0x151d63){return new Promise(function(_0xe92f9f,_0x29b464){return db[_0xb6d2('0x23')][_0xb6d2('0x24')]({'where':_0x151d63[_0xb6d2('0x1b')]?_0x151d63['options'][_0xb6d2('0x1d')]||null:null})[_0xb6d2('0x12')](function(_0x10b2de){if(_0x10b2de){return _0x10b2de[_0xb6d2('0x25')](_0x151d63[_0xb6d2('0x1a')][_0xb6d2('0x26')],_[_0xb6d2('0x27')](_0x151d63[_0xb6d2('0x1a')],[_0xb6d2('0x26'),'id'])||{});}})['spread'](function(_0x74c204){logger[_0xb6d2('0x13')](_0xb6d2('0x28'),_0x151d63);logger[_0xb6d2('0x29')](_0xb6d2('0x28'),_0x151d63,JSON[_0xb6d2('0x21')](_0x74c204));_0xe92f9f(_0x74c204);})[_0xb6d2('0x2a')](function(_0x34dda9){logger['error'](_0xb6d2('0x28'),_0x34dda9[_0xb6d2('0x17')],_0x151d63);_0x29b464(_this[_0xb6d2('0x16')](0x1f4,_0x34dda9[_0xb6d2('0x17')]));});});};
\ No newline at end of file