Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 656d918..8131be9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ea7=['localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ea7,0x9a));var _0x71ea=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x1ea7[_0x4c7935];return _0x30651d;};'use strict';var _=require('lodash');var util=require(_0x71ea('0x0'));var moment=require('moment');var BPromise=require(_0x71ea('0x1'));var rs=require(_0x71ea('0x2'));var fs=require('fs');var Redis=require(_0x71ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x71ea('0x4'));var logger=require(_0x71ea('0x5'))('rpc');var config=require(_0x71ea('0x6'));var jayson=require(_0x71ea('0x7'));var client=jayson['client'][_0x71ea('0x8')]({'port':0x232a});config[_0x71ea('0x9')]=_['defaults'](config[_0x71ea('0x9')],{'host':_0x71ea('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71ea('0x9')]));require(_0x71ea('0xb'))[_0x71ea('0xc')](socket);function respondWithRpcPromise(_0x2607c9,_0x20241d,_0x5b6efc){return new BPromise(function(_0x47cb1a,_0x376aa0){return client[_0x71ea('0xd')](_0x2607c9,_0x5b6efc)[_0x71ea('0xe')](function(_0x227dc7){logger[_0x71ea('0xf')](_0x71ea('0x10'),_0x20241d,_0x71ea('0x11'));logger[_0x71ea('0x12')](_0x71ea('0x13'),_0x20241d,_0x71ea('0x11'),JSON[_0x71ea('0x14')](_0x227dc7));if(_0x227dc7[_0x71ea('0x15')]){if(_0x227dc7[_0x71ea('0x15')][_0x71ea('0x16')]===0x1f4){logger[_0x71ea('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x20241d,_0x227dc7['error'][_0x71ea('0x17')]);return _0x376aa0(_0x227dc7['error'][_0x71ea('0x17')]);}logger['error'](_0x71ea('0x10'),_0x20241d,_0x227dc7[_0x71ea('0x15')][_0x71ea('0x17')]);return _0x47cb1a(_0x227dc7[_0x71ea('0x15')][_0x71ea('0x17')]);}else{logger[_0x71ea('0xf')](_0x71ea('0x10'),_0x20241d,_0x71ea('0x11'));_0x47cb1a(_0x227dc7[_0x71ea('0x18')][_0x71ea('0x17')]);}})[_0x71ea('0x19')](function(_0x317424){logger[_0x71ea('0x15')](_0x71ea('0x10'),_0x20241d,_0x317424);_0x376aa0(_0x317424);});});}exports['UpdateWhatsappInteraction']=function(_0x3034c4){var _0x2e6545=this;return new Promise(function(_0x683a0,_0x307153){return db[_0x71ea('0x1a')]['update'](_0x3034c4['body'],{'raw':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1d')]||null:null,'attributes':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1e')]||null:null,'limit':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1f')]||null:null})[_0x71ea('0xe')](function(_0x48631f){logger[_0x71ea('0xf')](_0x71ea('0x20'),_0x3034c4);logger[_0x71ea('0x12')](_0x71ea('0x20'),_0x3034c4,JSON[_0x71ea('0x14')](_0x48631f));_0x683a0(_0x48631f);})[_0x71ea('0x19')](function(_0x1a1882){logger[_0x71ea('0x15')](_0x71ea('0x20'),_0x1a1882[_0x71ea('0x17')],_0x3034c4);_0x307153(_0x2e6545[_0x71ea('0x15')](0x1f4,_0x1a1882[_0x71ea('0x17')]));});});};exports[_0x71ea('0x21')]=function(_0x36a340){return new Promise(function(_0x1c5abf,_0x4e5cf2){return db[_0x71ea('0x1a')][_0x71ea('0x22')]({'where':_0x36a340[_0x71ea('0x1b')]?_0x36a340[_0x71ea('0x1b')][_0x71ea('0x1d')]||null:null})[_0x71ea('0xe')](function(_0xd61495){if(_0xd61495){return _0xd61495[_0x71ea('0x23')](_0x36a340[_0x71ea('0x24')]['ids'],_[_0x71ea('0x25')](_0x36a340[_0x71ea('0x24')],[_0x71ea('0x26'),'id'])||{});}})[_0x71ea('0x27')](function(_0x15aab7){logger[_0x71ea('0xf')](_0x71ea('0x28'),_0x36a340);logger[_0x71ea('0x12')](_0x71ea('0x28'),_0x36a340,JSON[_0x71ea('0x14')](_0x15aab7));_0x1c5abf(_0x15aab7);})['catch'](function(_0x1e574e){logger['error'](_0x71ea('0x28'),_0x1e574e[_0x71ea('0x17')],_0x36a340);_0x4e5cf2(_this[_0x71ea('0x15')](0x1f4,_0x1e574e[_0x71ea('0x17')]));});});};
\ No newline at end of file
+var _0x0bbc=['WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','UpdateWhatsappInteraction'];(function(_0x30c713,_0x14ddfd){var _0x5791af=function(_0x17e37d){while(--_0x17e37d){_0x30c713['push'](_0x30c713['shift']());}};_0x5791af(++_0x14ddfd);}(_0x0bbc,0x1dc));var _0xc0bb=function(_0x2a3eab,_0x465414){_0x2a3eab=_0x2a3eab-0x0;var _0x931762=_0x0bbc[_0x2a3eab];return _0x931762;};'use strict';var _=require(_0xc0bb('0x0'));var util=require(_0xc0bb('0x1'));var moment=require(_0xc0bb('0x2'));var BPromise=require(_0xc0bb('0x3'));var rs=require(_0xc0bb('0x4'));var fs=require('fs');var Redis=require(_0xc0bb('0x5'));var db=require(_0xc0bb('0x6'))['db'];var utils=require(_0xc0bb('0x7'));var logger=require(_0xc0bb('0x8'))(_0xc0bb('0x9'));var config=require(_0xc0bb('0xa'));var jayson=require(_0xc0bb('0xb'));var client=jayson[_0xc0bb('0xc')]['http']({'port':0x232a});config['redis']=_[_0xc0bb('0xd')](config[_0xc0bb('0xe')],{'host':_0xc0bb('0xf'),'port':0x18eb});var socket=require(_0xc0bb('0x10'))(new Redis(config['redis']));require(_0xc0bb('0x11'))[_0xc0bb('0x12')](socket);function respondWithRpcPromise(_0x368f35,_0x2ac4a4,_0x133899){return new BPromise(function(_0x584c68,_0x3e2843){return client[_0xc0bb('0x13')](_0x368f35,_0x133899)[_0xc0bb('0x14')](function(_0x2f8209){logger[_0xc0bb('0x15')](_0xc0bb('0x16'),_0x2ac4a4,'request\x20sent');logger[_0xc0bb('0x17')](_0xc0bb('0x18'),_0x2ac4a4,_0xc0bb('0x19'),JSON['stringify'](_0x2f8209));if(_0x2f8209[_0xc0bb('0x1a')]){if(_0x2f8209[_0xc0bb('0x1a')]['code']===0x1f4){logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);return _0x3e2843(_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);}logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);return _0x584c68(_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);}else{logger[_0xc0bb('0x15')](_0xc0bb('0x16'),_0x2ac4a4,_0xc0bb('0x19'));_0x584c68(_0x2f8209['result']['message']);}})[_0xc0bb('0x1c')](function(_0xc0f7a){logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0xc0f7a);_0x3e2843(_0xc0f7a);});});}exports[_0xc0bb('0x1d')]=function(_0x479718){var _0x46d366=this;return new Promise(function(_0x1700c9,_0x2605a9){return db[_0xc0bb('0x1e')][_0xc0bb('0x1f')](_0x479718[_0xc0bb('0x20')],{'raw':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x479718[_0xc0bb('0x21')]?_0x479718[_0xc0bb('0x21')][_0xc0bb('0x23')]||null:null,'attributes':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x24')]||null:null,'limit':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x25')]||null:null})['then'](function(_0x124bd8){logger['info']('UpdateWhatsappInteraction',_0x479718);logger[_0xc0bb('0x17')]('UpdateWhatsappInteraction',_0x479718,JSON[_0xc0bb('0x26')](_0x124bd8));_0x1700c9(_0x124bd8);})[_0xc0bb('0x1c')](function(_0x8c3c39){logger[_0xc0bb('0x1a')](_0xc0bb('0x1d'),_0x8c3c39['message'],_0x479718);_0x2605a9(_0x46d366[_0xc0bb('0x1a')](0x1f4,_0x8c3c39['message']));});});};exports[_0xc0bb('0x27')]=function(_0x418896){return new Promise(function(_0xc4f376,_0x50c4be){return db['WhatsappInteraction'][_0xc0bb('0x28')]({'where':_0x418896['options']?_0x418896['options']['where']||null:null})['then'](function(_0x3dcf06){if(_0x3dcf06){return _0x3dcf06[_0xc0bb('0x29')](_0x418896[_0xc0bb('0x20')][_0xc0bb('0x2a')],_[_0xc0bb('0x2b')](_0x418896[_0xc0bb('0x20')],[_0xc0bb('0x2a'),'id'])||{});}})[_0xc0bb('0x2c')](function(_0x78fcba){logger[_0xc0bb('0x15')]('AddTags',_0x418896);logger[_0xc0bb('0x17')](_0xc0bb('0x2d'),_0x418896,JSON[_0xc0bb('0x26')](_0x78fcba));_0xc4f376(_0x78fcba);})['catch'](function(_0x4b1498){logger['error'](_0xc0bb('0x2d'),_0x4b1498[_0xc0bb('0x1b')],_0x418896);_0x50c4be(_this[_0xc0bb('0x1a')](0x1f4,_0x4b1498[_0xc0bb('0x1b')]));});});};
\ No newline at end of file