Built motion from commit eddce310.|2.6.12
[motion2.git] / server / api / smsQueue / smsQueue.rpc.js
index e33c8a5..b9b4d62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f92=['findAll','options','where','attributes','limit','include','map','model','ShowSmsQueue','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue'];(function(_0x4773c8,_0x154aa1){var _0x30312a=function(_0x472d0d){while(--_0x472d0d){_0x4773c8['push'](_0x4773c8['shift']());}};_0x30312a(++_0x154aa1);}(_0x6f92,0xfb));var _0x26f9=function(_0x3f4fe0,_0x10ae2f){_0x3f4fe0=_0x3f4fe0-0x0;var _0x12fa55=_0x6f92[_0x3f4fe0];return _0x12fa55;};'use strict';var _=require('lodash');var util=require(_0x26f9('0x0'));var moment=require(_0x26f9('0x1'));var BPromise=require(_0x26f9('0x2'));var rs=require(_0x26f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x26f9('0x5'))('rpc');var config=require(_0x26f9('0x6'));var jayson=require(_0x26f9('0x7'));var client=jayson[_0x26f9('0x8')]['http']({'port':0x232a});config[_0x26f9('0x9')]=_[_0x26f9('0xa')](config[_0x26f9('0x9')],{'host':_0x26f9('0xb'),'port':0x18eb});var socket=require(_0x26f9('0xc'))(new Redis(config[_0x26f9('0x9')]));require(_0x26f9('0xd'))[_0x26f9('0xe')](socket);function respondWithRpcPromise(_0x1d0dc4,_0x58c219,_0x500255){return new BPromise(function(_0x3d35bc,_0xcc27f9){return client[_0x26f9('0xf')](_0x1d0dc4,_0x500255)[_0x26f9('0x10')](function(_0x4359d5){logger[_0x26f9('0x11')](_0x26f9('0x12'),_0x58c219,'request\x20sent');logger[_0x26f9('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x58c219,'request\x20sent',JSON[_0x26f9('0x14')](_0x4359d5));if(_0x4359d5[_0x26f9('0x15')]){if(_0x4359d5['error'][_0x26f9('0x16')]===0x1f4){logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4359d5[_0x26f9('0x15')][_0x26f9('0x17')]);return _0xcc27f9(_0x4359d5[_0x26f9('0x15')][_0x26f9('0x17')]);}logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4359d5[_0x26f9('0x15')]['message']);return _0x3d35bc(_0x4359d5[_0x26f9('0x15')]['message']);}else{logger[_0x26f9('0x11')](_0x26f9('0x12'),_0x58c219,_0x26f9('0x18'));_0x3d35bc(_0x4359d5[_0x26f9('0x19')]['message']);}})[_0x26f9('0x1a')](function(_0x4ea6da){logger[_0x26f9('0x15')](_0x26f9('0x12'),_0x58c219,_0x4ea6da);_0xcc27f9(_0x4ea6da);});});}exports[_0x26f9('0x1b')]=function(_0x444f41){var _0x593efd=this;return new Promise(function(_0x3e8248,_0x17beb0){return db[_0x26f9('0x1c')][_0x26f9('0x1d')]({'raw':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x444f41['options']?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x1f')]||null:null,'attributes':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x20')]||null:null,'limit':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x21')]||null:null,'include':_0x444f41[_0x26f9('0x1e')]?_0x444f41[_0x26f9('0x1e')][_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x444f41[_0x26f9('0x1e')][_0x26f9('0x22')],function(_0x201baf){return{'model':db[_0x201baf[_0x26f9('0x24')]],'as':_0x201baf['as'],'attributes':_0x201baf['attributes'],'include':_0x201baf[_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x201baf[_0x26f9('0x22')],function(_0x4d8d47){return{'model':db[_0x4d8d47[_0x26f9('0x24')]],'as':_0x4d8d47['as'],'attributes':_0x4d8d47[_0x26f9('0x20')],'include':_0x4d8d47[_0x26f9('0x22')]?_['map'](_0x4d8d47['include'],function(_0x3622f3){return{'model':db[_0x3622f3[_0x26f9('0x24')]],'as':_0x3622f3['as'],'attributes':_0x3622f3[_0x26f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x26f9('0x10')](function(_0x4ecf65){logger[_0x26f9('0x11')]('GetSmsQueue',_0x444f41);logger[_0x26f9('0x13')](_0x26f9('0x1b'),_0x444f41,JSON[_0x26f9('0x14')](_0x4ecf65));_0x3e8248(_0x4ecf65);})['catch'](function(_0x2d5155){logger[_0x26f9('0x15')](_0x26f9('0x1b'),_0x2d5155['message'],_0x444f41);_0x17beb0(_0x593efd['error'](0x1f4,_0x2d5155['message']));});});};exports[_0x26f9('0x25')]=function(_0x44c59e){var _0x12af93=this;return new Promise(function(_0x2041a7,_0x2711e9){return db[_0x26f9('0x1c')][_0x26f9('0x26')]({'raw':_0x44c59e['options']?_0x44c59e[_0x26f9('0x1e')][_0x26f9('0x27')]===undefined?!![]:![]:!![],'where':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x1f')]||null:null,'attributes':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x20')]||null:null,'include':_0x44c59e[_0x26f9('0x1e')]?_0x44c59e['options'][_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x44c59e[_0x26f9('0x1e')][_0x26f9('0x22')],function(_0x296b41){return{'model':db[_0x296b41['model']],'as':_0x296b41['as'],'attributes':_0x296b41['attributes'],'include':_0x296b41[_0x26f9('0x22')]?_['map'](_0x296b41[_0x26f9('0x22')],function(_0x267d9e){return{'model':db[_0x267d9e['model']],'as':_0x267d9e['as'],'attributes':_0x267d9e[_0x26f9('0x20')],'include':_0x267d9e[_0x26f9('0x22')]?_[_0x26f9('0x23')](_0x267d9e['include'],function(_0x10098c){return{'model':db[_0x10098c[_0x26f9('0x24')]],'as':_0x10098c['as'],'attributes':_0x10098c[_0x26f9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9b1f){logger[_0x26f9('0x11')]('ShowSmsQueue',_0x44c59e);logger[_0x26f9('0x13')](_0x26f9('0x25'),_0x44c59e,JSON[_0x26f9('0x14')](_0x5e9b1f));_0x2041a7(_0x5e9b1f);})[_0x26f9('0x1a')](function(_0x2ff5eb){logger[_0x26f9('0x15')]('ShowSmsQueue',_0x2ff5eb[_0x26f9('0x17')],_0x44c59e);_0x2711e9(_0x12af93[_0x26f9('0x15')](0x1f4,_0x2ff5eb['message']));});});};
\ No newline at end of file
+var _0x5aab=['http','redis','defaults','register','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x548f68,_0x2db63e){var _0x1adf80=function(_0x5b08e6){while(--_0x5b08e6){_0x548f68['push'](_0x548f68['shift']());}};_0x1adf80(++_0x2db63e);}(_0x5aab,0x154));var _0xb5aa=function(_0x11c7bc,_0x5a7b4c){_0x11c7bc=_0x11c7bc-0x0;var _0x1289df=_0x5aab[_0x11c7bc];return _0x1289df;};'use strict';var _=require(_0xb5aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb5aa('0x1'));var rs=require(_0xb5aa('0x2'));var fs=require('fs');var Redis=require(_0xb5aa('0x3'));var db=require(_0xb5aa('0x4'))['db'];var utils=require(_0xb5aa('0x5'));var logger=require(_0xb5aa('0x6'))(_0xb5aa('0x7'));var config=require(_0xb5aa('0x8'));var jayson=require(_0xb5aa('0x9'));var client=jayson[_0xb5aa('0xa')][_0xb5aa('0xb')]({'port':0x232a});config[_0xb5aa('0xc')]=_[_0xb5aa('0xd')](config[_0xb5aa('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5aa('0xc')]));require('./smsQueue.socket')[_0xb5aa('0xe')](socket);function respondWithRpcPromise(_0xf768c2,_0x2091d5,_0xf33f7b){return new BPromise(function(_0x3ce25c,_0x206b28){return client['request'](_0xf768c2,_0xf33f7b)['then'](function(_0x6ca673){logger['info']('SmsQueue,\x20%s,\x20%s',_0x2091d5,_0xb5aa('0xf'));logger[_0xb5aa('0x10')](_0xb5aa('0x11'),_0x2091d5,_0xb5aa('0xf'),JSON[_0xb5aa('0x12')](_0x6ca673));if(_0x6ca673[_0xb5aa('0x13')]){if(_0x6ca673['error'][_0xb5aa('0x14')]===0x1f4){logger[_0xb5aa('0x13')](_0xb5aa('0x15'),_0x2091d5,_0x6ca673[_0xb5aa('0x13')][_0xb5aa('0x16')]);return _0x206b28(_0x6ca673[_0xb5aa('0x13')][_0xb5aa('0x16')]);}logger[_0xb5aa('0x13')](_0xb5aa('0x15'),_0x2091d5,_0x6ca673[_0xb5aa('0x13')][_0xb5aa('0x16')]);return _0x3ce25c(_0x6ca673['error'][_0xb5aa('0x16')]);}else{logger[_0xb5aa('0x17')](_0xb5aa('0x15'),_0x2091d5,_0xb5aa('0xf'));_0x3ce25c(_0x6ca673['result'][_0xb5aa('0x16')]);}})[_0xb5aa('0x18')](function(_0x324d51){logger['error'](_0xb5aa('0x15'),_0x2091d5,_0x324d51);_0x206b28(_0x324d51);});});}exports[_0xb5aa('0x19')]=function(_0x178c37){var _0x4b0696=this;return new Promise(function(_0x3dd0d5,_0x1ec3f0){return db[_0xb5aa('0x1a')][_0xb5aa('0x1b')]({'raw':_0x178c37['options']?_0x178c37[_0xb5aa('0x1c')][_0xb5aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x178c37['options']?_0x178c37[_0xb5aa('0x1c')][_0xb5aa('0x1e')]||null:null,'attributes':_0x178c37['options']?_0x178c37['options']['attributes']||null:null,'limit':_0x178c37[_0xb5aa('0x1c')]?_0x178c37[_0xb5aa('0x1c')][_0xb5aa('0x1f')]||null:null,'include':_0x178c37[_0xb5aa('0x1c')]?_0x178c37[_0xb5aa('0x1c')][_0xb5aa('0x20')]?_[_0xb5aa('0x21')](_0x178c37['options'][_0xb5aa('0x20')],function(_0xf0ffb4){return{'model':db[_0xf0ffb4[_0xb5aa('0x22')]],'as':_0xf0ffb4['as'],'attributes':_0xf0ffb4[_0xb5aa('0x23')],'include':_0xf0ffb4[_0xb5aa('0x20')]?_['map'](_0xf0ffb4[_0xb5aa('0x20')],function(_0x127148){return{'model':db[_0x127148[_0xb5aa('0x22')]],'as':_0x127148['as'],'attributes':_0x127148[_0xb5aa('0x23')],'include':_0x127148[_0xb5aa('0x20')]?_[_0xb5aa('0x21')](_0x127148[_0xb5aa('0x20')],function(_0x35388c){return{'model':db[_0x35388c[_0xb5aa('0x22')]],'as':_0x35388c['as'],'attributes':_0x35388c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5aa('0x24')](function(_0x4b0db9){logger[_0xb5aa('0x17')](_0xb5aa('0x19'),_0x178c37);logger[_0xb5aa('0x10')](_0xb5aa('0x19'),_0x178c37,JSON['stringify'](_0x4b0db9));_0x3dd0d5(_0x4b0db9);})[_0xb5aa('0x18')](function(_0x1e4bad){logger[_0xb5aa('0x13')](_0xb5aa('0x19'),_0x1e4bad['message'],_0x178c37);_0x1ec3f0(_0x4b0696[_0xb5aa('0x13')](0x1f4,_0x1e4bad['message']));});});};exports[_0xb5aa('0x25')]=function(_0x3ecb9d){var _0x3136a3=this;return new Promise(function(_0x2d0823,_0xf3bdc3){return db['SmsQueue'][_0xb5aa('0x26')]({'raw':_0x3ecb9d[_0xb5aa('0x1c')]?_0x3ecb9d[_0xb5aa('0x1c')][_0xb5aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ecb9d[_0xb5aa('0x1c')]?_0x3ecb9d['options'][_0xb5aa('0x1e')]||null:null,'attributes':_0x3ecb9d[_0xb5aa('0x1c')]?_0x3ecb9d[_0xb5aa('0x1c')][_0xb5aa('0x23')]||null:null,'include':_0x3ecb9d[_0xb5aa('0x1c')]?_0x3ecb9d['options'][_0xb5aa('0x20')]?_[_0xb5aa('0x21')](_0x3ecb9d[_0xb5aa('0x1c')][_0xb5aa('0x20')],function(_0xfe5594){return{'model':db[_0xfe5594[_0xb5aa('0x22')]],'as':_0xfe5594['as'],'attributes':_0xfe5594[_0xb5aa('0x23')],'include':_0xfe5594['include']?_['map'](_0xfe5594[_0xb5aa('0x20')],function(_0x33cbe0){return{'model':db[_0x33cbe0[_0xb5aa('0x22')]],'as':_0x33cbe0['as'],'attributes':_0x33cbe0['attributes'],'include':_0x33cbe0['include']?_[_0xb5aa('0x21')](_0x33cbe0[_0xb5aa('0x20')],function(_0x1d9d21){return{'model':db[_0x1d9d21[_0xb5aa('0x22')]],'as':_0x1d9d21['as'],'attributes':_0x1d9d21[_0xb5aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb5aa('0x24')](function(_0x306dc4){logger[_0xb5aa('0x17')](_0xb5aa('0x25'),_0x3ecb9d);logger[_0xb5aa('0x10')](_0xb5aa('0x25'),_0x3ecb9d,JSON[_0xb5aa('0x12')](_0x306dc4));_0x2d0823(_0x306dc4);})[_0xb5aa('0x18')](function(_0x42f387){logger[_0xb5aa('0x13')](_0xb5aa('0x25'),_0x42f387[_0xb5aa('0x16')],_0x3ecb9d);_0xf3bdc3(_0x3136a3[_0xb5aa('0x13')](0x1f4,_0x42f387[_0xb5aa('0x16')]));});});};
\ No newline at end of file