Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / smsQueue / smsQueue.rpc.js
index aaf3c91..ff059df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a56=['redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','include','model','map','stringify','ShowSmsQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x108815,_0x2b98a7){var _0x31da60=function(_0x3df019){while(--_0x3df019){_0x108815['push'](_0x108815['shift']());}};_0x31da60(++_0x2b98a7);}(_0x5a56,0x91));var _0x65a5=function(_0x21eb55,_0x58785f){_0x21eb55=_0x21eb55-0x0;var _0x2fd716=_0x5a56[_0x21eb55];return _0x2fd716;};'use strict';var _=require(_0x65a5('0x0'));var util=require('util');var moment=require(_0x65a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x65a5('0x2'));var fs=require('fs');var Redis=require(_0x65a5('0x3'));var db=require(_0x65a5('0x4'))['db'];var utils=require(_0x65a5('0x5'));var logger=require(_0x65a5('0x6'))(_0x65a5('0x7'));var config=require(_0x65a5('0x8'));var jayson=require(_0x65a5('0x9'));var client=jayson['client'][_0x65a5('0xa')]({'port':0x232a});config[_0x65a5('0xb')]=_['defaults'](config[_0x65a5('0xb')],{'host':_0x65a5('0xc'),'port':0x18eb});var socket=require(_0x65a5('0xd'))(new Redis(config['redis']));require(_0x65a5('0xe'))[_0x65a5('0xf')](socket);function respondWithRpcPromise(_0x3e90d0,_0x8e29ad,_0x30dafc){return new BPromise(function(_0xb07ed8,_0x38d5a0){return client[_0x65a5('0x10')](_0x3e90d0,_0x30dafc)[_0x65a5('0x11')](function(_0x2cf5fd){logger['info'](_0x65a5('0x12'),_0x8e29ad,_0x65a5('0x13'));logger[_0x65a5('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x8e29ad,'request\x20sent',JSON['stringify'](_0x2cf5fd));if(_0x2cf5fd['error']){if(_0x2cf5fd[_0x65a5('0x15')][_0x65a5('0x16')]===0x1f4){logger[_0x65a5('0x15')](_0x65a5('0x12'),_0x8e29ad,_0x2cf5fd['error'][_0x65a5('0x17')]);return _0x38d5a0(_0x2cf5fd[_0x65a5('0x15')][_0x65a5('0x17')]);}logger['error'](_0x65a5('0x12'),_0x8e29ad,_0x2cf5fd['error'][_0x65a5('0x17')]);return _0xb07ed8(_0x2cf5fd[_0x65a5('0x15')]['message']);}else{logger[_0x65a5('0x18')](_0x65a5('0x12'),_0x8e29ad,_0x65a5('0x13'));_0xb07ed8(_0x2cf5fd[_0x65a5('0x19')][_0x65a5('0x17')]);}})[_0x65a5('0x1a')](function(_0x4bf750){logger[_0x65a5('0x15')]('SmsQueue,\x20%s,\x20%s',_0x8e29ad,_0x4bf750);_0x38d5a0(_0x4bf750);});});}exports[_0x65a5('0x1b')]=function(_0x66f2f6){var _0x209291=this;return new Promise(function(_0x141283,_0x56a4e4){return db[_0x65a5('0x1c')]['findAll']({'raw':_0x66f2f6[_0x65a5('0x1d')]?_0x66f2f6[_0x65a5('0x1d')][_0x65a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x66f2f6[_0x65a5('0x1d')]?_0x66f2f6[_0x65a5('0x1d')][_0x65a5('0x1f')]||null:null,'attributes':_0x66f2f6[_0x65a5('0x1d')]?_0x66f2f6[_0x65a5('0x1d')][_0x65a5('0x20')]||null:null,'limit':_0x66f2f6['options']?_0x66f2f6[_0x65a5('0x1d')]['limit']||null:null,'include':_0x66f2f6[_0x65a5('0x1d')]?_0x66f2f6['options'][_0x65a5('0x21')]?_['map'](_0x66f2f6[_0x65a5('0x1d')][_0x65a5('0x21')],function(_0x1a3296){return{'model':db[_0x1a3296[_0x65a5('0x22')]],'as':_0x1a3296['as'],'attributes':_0x1a3296[_0x65a5('0x20')],'include':_0x1a3296['include']?_[_0x65a5('0x23')](_0x1a3296[_0x65a5('0x21')],function(_0x2e8b4b){return{'model':db[_0x2e8b4b[_0x65a5('0x22')]],'as':_0x2e8b4b['as'],'attributes':_0x2e8b4b[_0x65a5('0x20')],'include':_0x2e8b4b[_0x65a5('0x21')]?_[_0x65a5('0x23')](_0x2e8b4b[_0x65a5('0x21')],function(_0x135d7a){return{'model':db[_0x135d7a[_0x65a5('0x22')]],'as':_0x135d7a['as'],'attributes':_0x135d7a[_0x65a5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ad269){logger[_0x65a5('0x18')](_0x65a5('0x1b'),_0x66f2f6);logger[_0x65a5('0x14')](_0x65a5('0x1b'),_0x66f2f6,JSON[_0x65a5('0x24')](_0x1ad269));_0x141283(_0x1ad269);})[_0x65a5('0x1a')](function(_0x34d8c1){logger['error'](_0x65a5('0x1b'),_0x34d8c1[_0x65a5('0x17')],_0x66f2f6);_0x56a4e4(_0x209291[_0x65a5('0x15')](0x1f4,_0x34d8c1[_0x65a5('0x17')]));});});};exports[_0x65a5('0x25')]=function(_0x1a0190){var _0xcf226a=this;return new Promise(function(_0x34644f,_0x364f1f){return db[_0x65a5('0x1c')][_0x65a5('0x26')]({'raw':_0x1a0190[_0x65a5('0x1d')]?_0x1a0190['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a0190['options']?_0x1a0190['options'][_0x65a5('0x1f')]||null:null,'attributes':_0x1a0190[_0x65a5('0x1d')]?_0x1a0190['options']['attributes']||null:null,'include':_0x1a0190[_0x65a5('0x1d')]?_0x1a0190[_0x65a5('0x1d')][_0x65a5('0x21')]?_['map'](_0x1a0190[_0x65a5('0x1d')][_0x65a5('0x21')],function(_0x5f4d86){return{'model':db[_0x5f4d86[_0x65a5('0x22')]],'as':_0x5f4d86['as'],'attributes':_0x5f4d86['attributes'],'include':_0x5f4d86[_0x65a5('0x21')]?_['map'](_0x5f4d86[_0x65a5('0x21')],function(_0x3531ff){return{'model':db[_0x3531ff[_0x65a5('0x22')]],'as':_0x3531ff['as'],'attributes':_0x3531ff[_0x65a5('0x20')],'include':_0x3531ff[_0x65a5('0x21')]?_[_0x65a5('0x23')](_0x3531ff['include'],function(_0x2b3ea0){return{'model':db[_0x2b3ea0[_0x65a5('0x22')]],'as':_0x2b3ea0['as'],'attributes':_0x2b3ea0[_0x65a5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x65a5('0x11')](function(_0x3e65f7){logger[_0x65a5('0x18')](_0x65a5('0x25'),_0x1a0190);logger['debug']('ShowSmsQueue',_0x1a0190,JSON['stringify'](_0x3e65f7));_0x34644f(_0x3e65f7);})['catch'](function(_0x331648){logger[_0x65a5('0x15')](_0x65a5('0x25'),_0x331648[_0x65a5('0x17')],_0x1a0190);_0x364f1f(_0xcf226a[_0x65a5('0x15')](0x1f4,_0x331648[_0x65a5('0x17')]));});});};
\ No newline at end of file
+var _0xaa8a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment'];(function(_0x5440fa,_0x111ef8){var _0x49f3d0=function(_0x4ad803){while(--_0x4ad803){_0x5440fa['push'](_0x5440fa['shift']());}};_0x49f3d0(++_0x111ef8);}(_0xaa8a,0xdb));var _0xaaa8=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xaa8a[_0xbc4560];return _0x298cfb;};'use strict';var _=require(_0xaaa8('0x0'));var util=require(_0xaaa8('0x1'));var moment=require(_0xaaa8('0x2'));var BPromise=require('bluebird');var rs=require(_0xaaa8('0x3'));var fs=require('fs');var Redis=require(_0xaaa8('0x4'));var db=require(_0xaaa8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaa8('0x6'))(_0xaaa8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaaa8('0x8')]['http']({'port':0x232a});config[_0xaaa8('0x9')]=_[_0xaaa8('0xa')](config[_0xaaa8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaaa8('0xb'))(new Redis(config[_0xaaa8('0x9')]));require(_0xaaa8('0xc'))[_0xaaa8('0xd')](socket);function respondWithRpcPromise(_0xa179fd,_0x48519c,_0x16305f){return new BPromise(function(_0x102cda,_0x5a7088){return client['request'](_0xa179fd,_0x16305f)[_0xaaa8('0xe')](function(_0xdc1e36){logger[_0xaaa8('0xf')](_0xaaa8('0x10'),_0x48519c,_0xaaa8('0x11'));logger[_0xaaa8('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x48519c,_0xaaa8('0x11'),JSON[_0xaaa8('0x13')](_0xdc1e36));if(_0xdc1e36[_0xaaa8('0x14')]){if(_0xdc1e36[_0xaaa8('0x14')][_0xaaa8('0x15')]===0x1f4){logger['error'](_0xaaa8('0x10'),_0x48519c,_0xdc1e36['error']['message']);return _0x5a7088(_0xdc1e36['error'][_0xaaa8('0x16')]);}logger[_0xaaa8('0x14')]('SmsQueue,\x20%s,\x20%s',_0x48519c,_0xdc1e36[_0xaaa8('0x14')][_0xaaa8('0x16')]);return _0x102cda(_0xdc1e36['error'][_0xaaa8('0x16')]);}else{logger[_0xaaa8('0xf')](_0xaaa8('0x10'),_0x48519c,_0xaaa8('0x11'));_0x102cda(_0xdc1e36[_0xaaa8('0x17')][_0xaaa8('0x16')]);}})[_0xaaa8('0x18')](function(_0x54b88b){logger['error'](_0xaaa8('0x10'),_0x48519c,_0x54b88b);_0x5a7088(_0x54b88b);});});}exports['GetSmsQueue']=function(_0x28f772){var _0xb583d5=this;return new Promise(function(_0x1c1e24,_0x24f786){return db[_0xaaa8('0x19')][_0xaaa8('0x1a')]({'raw':_0x28f772[_0xaaa8('0x1b')]?_0x28f772['options'][_0xaaa8('0x1c')]===undefined?!![]:![]:!![],'where':_0x28f772[_0xaaa8('0x1b')]?_0x28f772[_0xaaa8('0x1b')]['where']||null:null,'attributes':_0x28f772[_0xaaa8('0x1b')]?_0x28f772[_0xaaa8('0x1b')][_0xaaa8('0x1d')]||null:null,'limit':_0x28f772[_0xaaa8('0x1b')]?_0x28f772[_0xaaa8('0x1b')][_0xaaa8('0x1e')]||null:null,'include':_0x28f772[_0xaaa8('0x1b')]?_0x28f772['options'][_0xaaa8('0x1f')]?_[_0xaaa8('0x20')](_0x28f772[_0xaaa8('0x1b')]['include'],function(_0x16b028){return{'model':db[_0x16b028['model']],'as':_0x16b028['as'],'attributes':_0x16b028[_0xaaa8('0x1d')],'include':_0x16b028['include']?_[_0xaaa8('0x20')](_0x16b028[_0xaaa8('0x1f')],function(_0x371675){return{'model':db[_0x371675[_0xaaa8('0x21')]],'as':_0x371675['as'],'attributes':_0x371675['attributes'],'include':_0x371675[_0xaaa8('0x1f')]?_[_0xaaa8('0x20')](_0x371675['include'],function(_0x31f2ff){return{'model':db[_0x31f2ff['model']],'as':_0x31f2ff['as'],'attributes':_0x31f2ff[_0xaaa8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaaa8('0xe')](function(_0x54f81d){logger['info'](_0xaaa8('0x22'),_0x28f772);logger[_0xaaa8('0x12')](_0xaaa8('0x22'),_0x28f772,JSON[_0xaaa8('0x13')](_0x54f81d));_0x1c1e24(_0x54f81d);})[_0xaaa8('0x18')](function(_0x362202){logger[_0xaaa8('0x14')](_0xaaa8('0x22'),_0x362202[_0xaaa8('0x16')],_0x28f772);_0x24f786(_0xb583d5['error'](0x1f4,_0x362202['message']));});});};exports[_0xaaa8('0x23')]=function(_0x3e60c3){var _0x4e597b=this;return new Promise(function(_0x6a3e39,_0xb17061){return db['SmsQueue'][_0xaaa8('0x24')]({'raw':_0x3e60c3[_0xaaa8('0x1b')]?_0x3e60c3['options'][_0xaaa8('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e60c3[_0xaaa8('0x1b')]?_0x3e60c3[_0xaaa8('0x1b')]['where']||null:null,'attributes':_0x3e60c3[_0xaaa8('0x1b')]?_0x3e60c3[_0xaaa8('0x1b')][_0xaaa8('0x1d')]||null:null,'include':_0x3e60c3['options']?_0x3e60c3[_0xaaa8('0x1b')][_0xaaa8('0x1f')]?_[_0xaaa8('0x20')](_0x3e60c3['options'][_0xaaa8('0x1f')],function(_0x5cdb86){return{'model':db[_0x5cdb86[_0xaaa8('0x21')]],'as':_0x5cdb86['as'],'attributes':_0x5cdb86[_0xaaa8('0x1d')],'include':_0x5cdb86[_0xaaa8('0x1f')]?_[_0xaaa8('0x20')](_0x5cdb86[_0xaaa8('0x1f')],function(_0x14d93d){return{'model':db[_0x14d93d[_0xaaa8('0x21')]],'as':_0x14d93d['as'],'attributes':_0x14d93d['attributes'],'include':_0x14d93d['include']?_[_0xaaa8('0x20')](_0x14d93d[_0xaaa8('0x1f')],function(_0x36c61a){return{'model':db[_0x36c61a['model']],'as':_0x36c61a['as'],'attributes':_0x36c61a[_0xaaa8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaaa8('0xe')](function(_0x3cfe0d){logger[_0xaaa8('0xf')](_0xaaa8('0x23'),_0x3e60c3);logger['debug']('ShowSmsQueue',_0x3e60c3,JSON[_0xaaa8('0x13')](_0x3cfe0d));_0x6a3e39(_0x3cfe0d);})['catch'](function(_0xe91d8e){logger[_0xaaa8('0x14')](_0xaaa8('0x23'),_0xe91d8e[_0xaaa8('0x16')],_0x3e60c3);_0xb17061(_0x4e597b[_0xaaa8('0x14')](0x1f4,_0xe91d8e[_0xaaa8('0x16')]));});});};
\ No newline at end of file