Built motion from commit 1ea47bf4.|2.6.34
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index c46fa6f..1a4919a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0441=['ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','where','attributes','limit','UpdateWhatsappInteraction','stringify','then','addTags','omit'];(function(_0x3174d4,_0x2b9f59){var _0x71d869=function(_0x1d5078){while(--_0x1d5078){_0x3174d4['push'](_0x3174d4['shift']());}};_0x71d869(++_0x2b9f59);}(_0x0441,0x16b));var _0x1044=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x0441[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x1044('0x0'));var util=require(_0x1044('0x1'));var moment=require(_0x1044('0x2'));var BPromise=require(_0x1044('0x3'));var rs=require(_0x1044('0x4'));var fs=require('fs');var Redis=require(_0x1044('0x5'));var db=require(_0x1044('0x6'))['db'];var utils=require(_0x1044('0x7'));var logger=require(_0x1044('0x8'))(_0x1044('0x9'));var config=require('../../config/environment');var jayson=require(_0x1044('0xa'));var client=jayson['client'][_0x1044('0xb')]({'port':0x232a});config[_0x1044('0xc')]=_[_0x1044('0xd')](config[_0x1044('0xc')],{'host':_0x1044('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1044('0xc')]));require(_0x1044('0xf'))[_0x1044('0x10')](socket);function respondWithRpcPromise(_0x1db04e,_0x5ccfe0,_0x43cadf){return new BPromise(function(_0x1f7f33,_0x5067d3){return client[_0x1044('0x11')](_0x1db04e,_0x43cadf)['then'](function(_0x147bb9){logger[_0x1044('0x12')](_0x1044('0x13'),_0x5ccfe0,_0x1044('0x14'));logger[_0x1044('0x15')](_0x1044('0x16'),_0x5ccfe0,'request\x20sent',JSON['stringify'](_0x147bb9));if(_0x147bb9[_0x1044('0x17')]){if(_0x147bb9[_0x1044('0x17')]['code']===0x1f4){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x5067d3(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x1f7f33(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}else{logger[_0x1044('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x1044('0x14'));_0x1f7f33(_0x147bb9[_0x1044('0x19')][_0x1044('0x18')]);}})[_0x1044('0x1a')](function(_0x303f84){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x303f84);_0x5067d3(_0x303f84);});});}exports['UpdateWhatsappInteraction']=function(_0x2f7fba){var _0xa5905=this;return new Promise(function(_0x2b7370,_0x1075dc){return db['WhatsappInteraction']['update'](_0x2f7fba[_0x1044('0x1b')],{'raw':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba['options'][_0x1044('0x1d')]||null:null,'attributes':_0x2f7fba['options']?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1e')]||null:null,'limit':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1f')]||null:null})['then'](function(_0x4ffa96){logger[_0x1044('0x12')]('UpdateWhatsappInteraction',_0x2f7fba);logger['debug'](_0x1044('0x20'),_0x2f7fba,JSON[_0x1044('0x21')](_0x4ffa96));_0x2b7370(_0x4ffa96);})[_0x1044('0x1a')](function(_0x45a8a9){logger[_0x1044('0x17')](_0x1044('0x20'),_0x45a8a9[_0x1044('0x18')],_0x2f7fba);_0x1075dc(_0xa5905[_0x1044('0x17')](0x1f4,_0x45a8a9[_0x1044('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x242eb2){return new Promise(function(_0xf36ee4,_0x58e79c){return db['WhatsappInteraction']['find']({'where':_0x242eb2[_0x1044('0x1c')]?_0x242eb2[_0x1044('0x1c')][_0x1044('0x1d')]||null:null})[_0x1044('0x22')](function(_0x9570fd){if(_0x9570fd){return _0x9570fd[_0x1044('0x23')](_0x242eb2[_0x1044('0x1b')]['ids'],_[_0x1044('0x24')](_0x242eb2[_0x1044('0x1b')],[_0x1044('0x25'),'id'])||{});}})[_0x1044('0x26')](function(_0x249f9c){logger['info'](_0x1044('0x27'),_0x242eb2);logger[_0x1044('0x15')](_0x1044('0x27'),_0x242eb2,JSON[_0x1044('0x21')](_0x249f9c));_0xf36ee4(_0x249f9c);})['catch'](function(_0xda4a56){logger[_0x1044('0x17')](_0x1044('0x27'),_0xda4a56[_0x1044('0x18')],_0x242eb2);_0x58e79c(_this[_0x1044('0x17')](0x1f4,_0xda4a56[_0x1044('0x18')]));});});};
\ No newline at end of file
+var _0xbf08=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateWhatsappInteraction','body','raw','options','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','AddTags','util','moment','bluebird','randomstring'];(function(_0x55c8f6,_0x8badfc){var _0x4949df=function(_0x13b756){while(--_0x13b756){_0x55c8f6['push'](_0x55c8f6['shift']());}};_0x4949df(++_0x8badfc);}(_0xbf08,0xc4));var _0x8bf0=function(_0xa90eea,_0x1262af){_0xa90eea=_0xa90eea-0x0;var _0x5f383a=_0xbf08[_0xa90eea];return _0x5f383a;};'use strict';var _=require('lodash');var util=require(_0x8bf0('0x0'));var moment=require(_0x8bf0('0x1'));var BPromise=require(_0x8bf0('0x2'));var rs=require(_0x8bf0('0x3'));var fs=require('fs');var Redis=require(_0x8bf0('0x4'));var db=require(_0x8bf0('0x5'))['db'];var utils=require(_0x8bf0('0x6'));var logger=require(_0x8bf0('0x7'))('rpc');var config=require(_0x8bf0('0x8'));var jayson=require(_0x8bf0('0x9'));var client=jayson['client'][_0x8bf0('0xa')]({'port':0x232a});config[_0x8bf0('0xb')]=_[_0x8bf0('0xc')](config[_0x8bf0('0xb')],{'host':_0x8bf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf0('0xb')]));require(_0x8bf0('0xe'))[_0x8bf0('0xf')](socket);function respondWithRpcPromise(_0x2eb9fc,_0x2c3a8e,_0x346c3f){return new BPromise(function(_0x4256cb,_0x4a2e42){return client[_0x8bf0('0x10')](_0x2eb9fc,_0x346c3f)[_0x8bf0('0x11')](function(_0x196c79){logger[_0x8bf0('0x12')](_0x8bf0('0x13'),_0x2c3a8e,_0x8bf0('0x14'));logger[_0x8bf0('0x15')](_0x8bf0('0x16'),_0x2c3a8e,_0x8bf0('0x14'),JSON[_0x8bf0('0x17')](_0x196c79));if(_0x196c79['error']){if(_0x196c79['error'][_0x8bf0('0x18')]===0x1f4){logger[_0x8bf0('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c3a8e,_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);return _0x4a2e42(_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);}logger[_0x8bf0('0x19')](_0x8bf0('0x13'),_0x2c3a8e,_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);return _0x4256cb(_0x196c79[_0x8bf0('0x19')]['message']);}else{logger[_0x8bf0('0x12')](_0x8bf0('0x13'),_0x2c3a8e,_0x8bf0('0x14'));_0x4256cb(_0x196c79['result'][_0x8bf0('0x1a')]);}})[_0x8bf0('0x1b')](function(_0x1d99dd){logger[_0x8bf0('0x19')](_0x8bf0('0x13'),_0x2c3a8e,_0x1d99dd);_0x4a2e42(_0x1d99dd);});});}exports[_0x8bf0('0x1c')]=function(_0x5d08b8){var _0x5c14e4=this;return new Promise(function(_0x235edc,_0x5e3690){return db['WhatsappInteraction']['update'](_0x5d08b8[_0x8bf0('0x1d')],{'raw':_0x5d08b8['options']?_0x5d08b8['options'][_0x8bf0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x20')]||null:null,'attributes':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x21')]||null:null,'limit':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x22')]||null:null})[_0x8bf0('0x11')](function(_0x2009ab){logger[_0x8bf0('0x12')](_0x8bf0('0x1c'),_0x5d08b8);logger[_0x8bf0('0x15')](_0x8bf0('0x1c'),_0x5d08b8,JSON[_0x8bf0('0x17')](_0x2009ab));_0x235edc(_0x2009ab);})['catch'](function(_0x403c42){logger[_0x8bf0('0x19')](_0x8bf0('0x1c'),_0x403c42['message'],_0x5d08b8);_0x5e3690(_0x5c14e4[_0x8bf0('0x19')](0x1f4,_0x403c42[_0x8bf0('0x1a')]));});});};exports[_0x8bf0('0x23')]=function(_0x48775f){return new Promise(function(_0x15576f,_0x3dc41a){return db[_0x8bf0('0x24')][_0x8bf0('0x25')]({'where':_0x48775f['options']?_0x48775f[_0x8bf0('0x1f')][_0x8bf0('0x20')]||null:null})[_0x8bf0('0x11')](function(_0x2c99bb){if(_0x2c99bb){return _0x2c99bb['addTags'](_0x48775f[_0x8bf0('0x1d')][_0x8bf0('0x26')],_['omit'](_0x48775f[_0x8bf0('0x1d')],[_0x8bf0('0x26'),'id'])||{});}})['spread'](function(_0xd59b88){logger[_0x8bf0('0x12')](_0x8bf0('0x27'),_0x48775f);logger['debug'](_0x8bf0('0x27'),_0x48775f,JSON[_0x8bf0('0x17')](_0xd59b88));_0x15576f(_0xd59b88);})['catch'](function(_0x4eca65){logger['error'](_0x8bf0('0x27'),_0x4eca65[_0x8bf0('0x1a')],_0x48775f);_0x3dc41a(_this[_0x8bf0('0x19')](0x1f4,_0x4eca65[_0x8bf0('0x1a')]));});});};
\ No newline at end of file