Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 7600dd8..01cad07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x95ed=['message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','stringify','find','where','ids','omit','spread','AddTags','util','moment','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x476a99,_0x3ae5d5){var _0x5a60da=function(_0x4b7883){while(--_0x4b7883){_0x476a99['push'](_0x476a99['shift']());}};_0x5a60da(++_0x3ae5d5);}(_0x95ed,0x1e5));var _0xd95e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x95ed[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0xd95e('0x0'));var moment=require(_0xd95e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd95e('0x2'));var logger=require('../../config/logger')(_0xd95e('0x3'));var config=require(_0xd95e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd95e('0x5')][_0xd95e('0x6')]({'port':0x232a});config[_0xd95e('0x7')]=_[_0xd95e('0x8')](config[_0xd95e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd95e('0x9'))(new Redis(config[_0xd95e('0x7')]));require('./whatsappInteraction.socket')[_0xd95e('0xa')](socket);function respondWithRpcPromise(_0x278c22,_0xb28adc,_0x310993){return new BPromise(function(_0x623889,_0x3395ba){return client[_0xd95e('0xb')](_0x278c22,_0x310993)[_0xd95e('0xc')](function(_0x54b3fc){logger['info'](_0xd95e('0xd'),_0xb28adc,_0xd95e('0xe'));logger[_0xd95e('0xf')](_0xd95e('0x10'),_0xb28adc,'request\x20sent',JSON['stringify'](_0x54b3fc));if(_0x54b3fc[_0xd95e('0x11')]){if(_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x12')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x13')]);return _0x3395ba(_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x13')]);}logger[_0xd95e('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x54b3fc['error']['message']);return _0x623889(_0x54b3fc[_0xd95e('0x11')]['message']);}else{logger[_0xd95e('0x14')](_0xd95e('0xd'),_0xb28adc,_0xd95e('0xe'));_0x623889(_0x54b3fc[_0xd95e('0x15')][_0xd95e('0x13')]);}})[_0xd95e('0x16')](function(_0x12926a){logger[_0xd95e('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x12926a);_0x3395ba(_0x12926a);});});}exports[_0xd95e('0x17')]=function(_0x1825ed){var _0x3393c9=this;return new Promise(function(_0x4a65f8,_0x447167){return db[_0xd95e('0x18')][_0xd95e('0x19')](_0x1825ed[_0xd95e('0x1a')],{'raw':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')][_0xd95e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')]['where']||null:null,'attributes':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')]['attributes']||null:null,'limit':_0x1825ed['options']?_0x1825ed[_0xd95e('0x1b')]['limit']||null:null})[_0xd95e('0xc')](function(_0x164af4){logger['info'](_0xd95e('0x17'),_0x1825ed);logger['debug'](_0xd95e('0x17'),_0x1825ed,JSON[_0xd95e('0x1d')](_0x164af4));_0x4a65f8(_0x164af4);})['catch'](function(_0x4f8663){logger[_0xd95e('0x11')](_0xd95e('0x17'),_0x4f8663['message'],_0x1825ed);_0x447167(_0x3393c9[_0xd95e('0x11')](0x1f4,_0x4f8663[_0xd95e('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3c7944){return new Promise(function(_0x538aa8,_0x15ec64){return db['WhatsappInteraction'][_0xd95e('0x1e')]({'where':_0x3c7944[_0xd95e('0x1b')]?_0x3c7944[_0xd95e('0x1b')][_0xd95e('0x1f')]||null:null})[_0xd95e('0xc')](function(_0x33e140){if(_0x33e140){return _0x33e140['addTags'](_0x3c7944['body'][_0xd95e('0x20')],_[_0xd95e('0x21')](_0x3c7944[_0xd95e('0x1a')],[_0xd95e('0x20'),'id'])||{});}})[_0xd95e('0x22')](function(_0x33a54d){logger['info'](_0xd95e('0x23'),_0x3c7944);logger[_0xd95e('0xf')](_0xd95e('0x23'),_0x3c7944,JSON[_0xd95e('0x1d')](_0x33a54d));_0x538aa8(_0x33a54d);})[_0xd95e('0x16')](function(_0x1f0d43){logger[_0xd95e('0x11')](_0xd95e('0x23'),_0x1f0d43['message'],_0x3c7944);_0x15ec64(_this[_0xd95e('0x11')](0x1f4,_0x1f0d43['message']));});});};
\ No newline at end of file
+var _0xa633=['error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','attributes','limit','then','debug','stringify','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xa633,0x11d));var _0x3a63=function(_0x27e046,_0x1944a2){_0x27e046=_0x27e046-0x0;var _0x535b52=_0xa633[_0x27e046];return _0x535b52;};'use strict';var _=require('lodash');var util=require(_0x3a63('0x0'));var moment=require(_0x3a63('0x1'));var BPromise=require(_0x3a63('0x2'));var rs=require(_0x3a63('0x3'));var fs=require('fs');var Redis=require(_0x3a63('0x4'));var db=require(_0x3a63('0x5'))['db'];var utils=require(_0x3a63('0x6'));var logger=require(_0x3a63('0x7'))(_0x3a63('0x8'));var config=require(_0x3a63('0x9'));var jayson=require(_0x3a63('0xa'));var client=jayson[_0x3a63('0xb')]['http']({'port':0x232a});config[_0x3a63('0xc')]=_['defaults'](config[_0x3a63('0xc')],{'host':_0x3a63('0xd'),'port':0x18eb});var socket=require(_0x3a63('0xe'))(new Redis(config[_0x3a63('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x351820,_0x3e7c11,_0x3c0e72){return new BPromise(function(_0x175e78,_0x4ff92a){return client[_0x3a63('0xf')](_0x351820,_0x3c0e72)['then'](function(_0x32880f){logger[_0x3a63('0x10')](_0x3a63('0x11'),_0x3e7c11,_0x3a63('0x12'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3e7c11,_0x3a63('0x12'),JSON['stringify'](_0x32880f));if(_0x32880f[_0x3a63('0x13')]){if(_0x32880f[_0x3a63('0x13')][_0x3a63('0x14')]===0x1f4){logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x32880f[_0x3a63('0x13')]['message']);return _0x4ff92a(_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);}logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);return _0x175e78(_0x32880f[_0x3a63('0x13')][_0x3a63('0x15')]);}else{logger['info'](_0x3a63('0x11'),_0x3e7c11,_0x3a63('0x12'));_0x175e78(_0x32880f['result'][_0x3a63('0x15')]);}})[_0x3a63('0x16')](function(_0x25834d){logger[_0x3a63('0x13')](_0x3a63('0x11'),_0x3e7c11,_0x25834d);_0x4ff92a(_0x25834d);});});}exports[_0x3a63('0x17')]=function(_0x4bb89c){var _0x233290=this;return new Promise(function(_0x589582,_0xf175e4){return db[_0x3a63('0x18')]['update'](_0x4bb89c[_0x3a63('0x19')],{'raw':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')][_0x3a63('0x1b')]||null:null,'attributes':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c['options'][_0x3a63('0x1c')]||null:null,'limit':_0x4bb89c[_0x3a63('0x1a')]?_0x4bb89c[_0x3a63('0x1a')][_0x3a63('0x1d')]||null:null})[_0x3a63('0x1e')](function(_0x4df1d6){logger['info'](_0x3a63('0x17'),_0x4bb89c);logger[_0x3a63('0x1f')]('UpdateWhatsappInteraction',_0x4bb89c,JSON[_0x3a63('0x20')](_0x4df1d6));_0x589582(_0x4df1d6);})[_0x3a63('0x16')](function(_0x1b8c5c){logger[_0x3a63('0x13')]('UpdateWhatsappInteraction',_0x1b8c5c['message'],_0x4bb89c);_0xf175e4(_0x233290[_0x3a63('0x13')](0x1f4,_0x1b8c5c[_0x3a63('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x29fd31){return new Promise(function(_0x359501,_0x5b0315){return db[_0x3a63('0x18')]['find']({'where':_0x29fd31[_0x3a63('0x1a')]?_0x29fd31[_0x3a63('0x1a')][_0x3a63('0x1b')]||null:null})[_0x3a63('0x1e')](function(_0x976595){if(_0x976595){return _0x976595[_0x3a63('0x21')](_0x29fd31['body'][_0x3a63('0x22')],_[_0x3a63('0x23')](_0x29fd31[_0x3a63('0x19')],[_0x3a63('0x22'),'id'])||{});}})[_0x3a63('0x24')](function(_0x2942ce){logger['info'](_0x3a63('0x25'),_0x29fd31);logger[_0x3a63('0x1f')](_0x3a63('0x25'),_0x29fd31,JSON['stringify'](_0x2942ce));_0x359501(_0x2942ce);})[_0x3a63('0x16')](function(_0x1e5379){logger[_0x3a63('0x13')]('AddTags',_0x1e5379[_0x3a63('0x15')],_0x29fd31);_0x5b0315(_this['error'](0x1f4,_0x1e5379[_0x3a63('0x15')]));});});};
\ No newline at end of file