Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / smsInteraction / smsInteraction.rpc.js
index bc4f246..3efbdfe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x597f=['where','then','message','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','result','UpdateSmsInteraction','SmsInteraction','body','raw','options'];(function(_0x46a13f,_0x2af5ca){var _0x2af8a6=function(_0x5dae04){while(--_0x5dae04){_0x46a13f['push'](_0x46a13f['shift']());}};_0x2af8a6(++_0x2af5ca);}(_0x597f,0xef));var _0xf597=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x597f[_0x155e04];return _0x4590d0;};'use strict';var _=require('lodash');var util=require(_0xf597('0x0'));var moment=require(_0xf597('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf597('0x2'));var db=require(_0xf597('0x3'))['db'];var utils=require(_0xf597('0x4'));var logger=require(_0xf597('0x5'))(_0xf597('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf597('0x7')][_0xf597('0x8')]({'port':0x232a});config[_0xf597('0x9')]=_[_0xf597('0xa')](config[_0xf597('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf597('0xb'))(new Redis(config['redis']));require(_0xf597('0xc'))[_0xf597('0xd')](socket);function respondWithRpcPromise(_0x434c90,_0x16be52,_0x20e3b0){return new BPromise(function(_0x19367b,_0x881fdb){return client[_0xf597('0xe')](_0x434c90,_0x20e3b0)['then'](function(_0x1fe72a){logger[_0xf597('0xf')](_0xf597('0x10'),_0x16be52,_0xf597('0x11'));logger[_0xf597('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x16be52,_0xf597('0x11'),JSON['stringify'](_0x1fe72a));if(_0x1fe72a['error']){if(_0x1fe72a[_0xf597('0x13')][_0xf597('0x14')]===0x1f4){logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x1fe72a['error']['message']);return _0x881fdb(_0x1fe72a['error']['message']);}logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x1fe72a[_0xf597('0x13')]['message']);return _0x19367b(_0x1fe72a['error']['message']);}else{logger[_0xf597('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x16be52,_0xf597('0x11'));_0x19367b(_0x1fe72a[_0xf597('0x15')]['message']);}})['catch'](function(_0x6ec65c){logger[_0xf597('0x13')](_0xf597('0x10'),_0x16be52,_0x6ec65c);_0x881fdb(_0x6ec65c);});});}exports[_0xf597('0x16')]=function(_0x4046b1){var _0x3e741c=this;return new Promise(function(_0xbfa8cd,_0x26dbb7){return db[_0xf597('0x17')]['update'](_0x4046b1[_0xf597('0x18')],{'raw':_0x4046b1['options']?_0x4046b1['options'][_0xf597('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4046b1['options']?_0x4046b1[_0xf597('0x1a')][_0xf597('0x1b')]||null:null,'attributes':_0x4046b1[_0xf597('0x1a')]?_0x4046b1[_0xf597('0x1a')]['attributes']||null:null,'limit':_0x4046b1[_0xf597('0x1a')]?_0x4046b1[_0xf597('0x1a')]['limit']||null:null})[_0xf597('0x1c')](function(_0x423400){logger['info'](_0xf597('0x16'),_0x4046b1);logger[_0xf597('0x12')](_0xf597('0x16'),_0x4046b1,JSON['stringify'](_0x423400));_0xbfa8cd(_0x423400);})['catch'](function(_0x1ac1f5){logger[_0xf597('0x13')](_0xf597('0x16'),_0x1ac1f5['message'],_0x4046b1);_0x26dbb7(_0x3e741c['error'](0x1f4,_0x1ac1f5[_0xf597('0x1d')]));});});};exports[_0xf597('0x1e')]=function(_0x1f4aaf){return new Promise(function(_0x18aa2b,_0x4a3d7e){return db[_0xf597('0x17')][_0xf597('0x1f')]({'where':_0x1f4aaf[_0xf597('0x1a')]?_0x1f4aaf[_0xf597('0x1a')][_0xf597('0x1b')]||null:null})[_0xf597('0x1c')](function(_0x26b4b2){if(_0x26b4b2){return _0x26b4b2[_0xf597('0x20')](_0x1f4aaf['body'][_0xf597('0x21')],_[_0xf597('0x22')](_0x1f4aaf[_0xf597('0x18')],[_0xf597('0x21'),'id'])||{});}})[_0xf597('0x23')](function(_0x506a7f){logger['info'](_0xf597('0x24'),_0x1f4aaf);logger[_0xf597('0x12')](_0xf597('0x24'),_0x1f4aaf,JSON['stringify'](_0x506a7f));_0x18aa2b(_0x506a7f);})[_0xf597('0x25')](function(_0xa2f9a5){logger['error'](_0xf597('0x24'),_0xa2f9a5['message'],_0x1f4aaf);_0x4a3d7e(_this['error'](0x1f4,_0xa2f9a5['message']));});});};
\ No newline at end of file
+var _0x1583=['../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','debug','find','body','ids','omit','spread','AddTags','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x1583,0x1e8));var _0x3158=function(_0x529141,_0x3b04c4){_0x529141=_0x529141-0x0;var _0x4aec85=_0x1583[_0x529141];return _0x4aec85;};'use strict';var _=require('lodash');var util=require(_0x3158('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3158('0x1'));var db=require(_0x3158('0x2'))['db'];var utils=require(_0x3158('0x3'));var logger=require(_0x3158('0x4'))(_0x3158('0x5'));var config=require(_0x3158('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3158('0x7')][_0x3158('0x8')]({'port':0x232a});config['redis']=_[_0x3158('0x9')](config['redis'],{'host':_0x3158('0xa'),'port':0x18eb});var socket=require(_0x3158('0xb'))(new Redis(config[_0x3158('0xc')]));require(_0x3158('0xd'))[_0x3158('0xe')](socket);function respondWithRpcPromise(_0xb2fa61,_0x5844c7,_0x67098b){return new BPromise(function(_0x3fa015,_0x30fb35){return client[_0x3158('0xf')](_0xb2fa61,_0x67098b)[_0x3158('0x10')](function(_0x3954f2){logger[_0x3158('0x11')](_0x3158('0x12'),_0x5844c7,'request\x20sent');logger['debug'](_0x3158('0x13'),_0x5844c7,_0x3158('0x14'),JSON[_0x3158('0x15')](_0x3954f2));if(_0x3954f2['error']){if(_0x3954f2[_0x3158('0x16')][_0x3158('0x17')]===0x1f4){logger[_0x3158('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5844c7,_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);return _0x30fb35(_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);}logger[_0x3158('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5844c7,_0x3954f2['error'][_0x3158('0x18')]);return _0x3fa015(_0x3954f2[_0x3158('0x16')][_0x3158('0x18')]);}else{logger[_0x3158('0x11')](_0x3158('0x12'),_0x5844c7,_0x3158('0x14'));_0x3fa015(_0x3954f2[_0x3158('0x19')][_0x3158('0x18')]);}})[_0x3158('0x1a')](function(_0x10c6f7){logger[_0x3158('0x16')](_0x3158('0x12'),_0x5844c7,_0x10c6f7);_0x30fb35(_0x10c6f7);});});}exports[_0x3158('0x1b')]=function(_0x48ecfb){var _0x35e3b1=this;return new Promise(function(_0x3d96fd,_0x274e9f){return db['SmsInteraction'][_0x3158('0x1c')](_0x48ecfb['body'],{'raw':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb['options'][_0x3158('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb[_0x3158('0x1d')][_0x3158('0x1f')]||null:null,'attributes':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb['options'][_0x3158('0x20')]||null:null,'limit':_0x48ecfb[_0x3158('0x1d')]?_0x48ecfb[_0x3158('0x1d')][_0x3158('0x21')]||null:null})[_0x3158('0x10')](function(_0x28f21d){logger[_0x3158('0x11')](_0x3158('0x1b'),_0x48ecfb);logger[_0x3158('0x22')](_0x3158('0x1b'),_0x48ecfb,JSON[_0x3158('0x15')](_0x28f21d));_0x3d96fd(_0x28f21d);})[_0x3158('0x1a')](function(_0x4b3841){logger[_0x3158('0x16')](_0x3158('0x1b'),_0x4b3841[_0x3158('0x18')],_0x48ecfb);_0x274e9f(_0x35e3b1[_0x3158('0x16')](0x1f4,_0x4b3841['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x589569){return new Promise(function(_0x33e4c2,_0x3183e6){return db['SmsInteraction'][_0x3158('0x23')]({'where':_0x589569['options']?_0x589569[_0x3158('0x1d')]['where']||null:null})[_0x3158('0x10')](function(_0x18955b){if(_0x18955b){return _0x18955b['addTags'](_0x589569[_0x3158('0x24')][_0x3158('0x25')],_[_0x3158('0x26')](_0x589569[_0x3158('0x24')],[_0x3158('0x25'),'id'])||{});}})[_0x3158('0x27')](function(_0x2c9f7){logger[_0x3158('0x11')](_0x3158('0x28'),_0x589569);logger[_0x3158('0x22')](_0x3158('0x28'),_0x589569,JSON['stringify'](_0x2c9f7));_0x33e4c2(_0x2c9f7);})[_0x3158('0x1a')](function(_0x55a22a){logger['error']('AddTags',_0x55a22a['message'],_0x589569);_0x3183e6(_this[_0x3158('0x16')](0x1f4,_0x55a22a[_0x3158('0x18')]));});});};
\ No newline at end of file