Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
index 52fbb28..8131be9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+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