Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / trunk / trunk.rpc.js
index 84f8c70..f5d44a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x5580db,_0x3bbb11){var _0x118116=function(_0xa7e54){while(--_0xa7e54){_0x5580db['push'](_0x5580db['shift']());}};_0x118116(++_0x3bbb11);}(_0xb7e7,0x121));var _0x7b7e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Trunk,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetTrunk',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['Trunk'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowTrunk',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});};
\ No newline at end of file
+var _0x95d3=['ShowTrunk','catch','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrunk','Trunk','findAll','raw','options','where','attributes','limit','include','map','model'];(function(_0x47c581,_0x243ec0){var _0x3022a4=function(_0x3098a3){while(--_0x3098a3){_0x47c581['push'](_0x47c581['shift']());}};_0x3022a4(++_0x243ec0);}(_0x95d3,0x138));var _0x395d=function(_0x96c15f,_0x538403){_0x96c15f=_0x96c15f-0x0;var _0x202a78=_0x95d3[_0x96c15f];return _0x202a78;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x395d('0x2'));var db=require(_0x395d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x395d('0x4'));var config=require('../../config/environment');var jayson=require(_0x395d('0x5'));var client=jayson[_0x395d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48aa96,_0x146009,_0x41e079){return new BPromise(function(_0x2cdc12,_0x4d9a1d){return client[_0x395d('0x7')](_0x48aa96,_0x41e079)[_0x395d('0x8')](function(_0xd16dca){logger[_0x395d('0x9')](_0x395d('0xa'),_0x146009,_0x395d('0xb'));logger[_0x395d('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x146009,'request\x20sent',JSON[_0x395d('0xd')](_0xd16dca));if(_0xd16dca[_0x395d('0xe')]){if(_0xd16dca[_0x395d('0xe')][_0x395d('0xf')]===0x1f4){logger[_0x395d('0xe')](_0x395d('0xa'),_0x146009,_0xd16dca[_0x395d('0xe')][_0x395d('0x10')]);return _0x4d9a1d(_0xd16dca[_0x395d('0xe')][_0x395d('0x10')]);}logger[_0x395d('0xe')](_0x395d('0xa'),_0x146009,_0xd16dca[_0x395d('0xe')]['message']);return _0x2cdc12(_0xd16dca['error'][_0x395d('0x10')]);}else{logger[_0x395d('0x9')](_0x395d('0xa'),_0x146009,_0x395d('0xb'));_0x2cdc12(_0xd16dca[_0x395d('0x11')][_0x395d('0x10')]);}})['catch'](function(_0x27fc7f){logger[_0x395d('0xe')]('Trunk,\x20%s,\x20%s',_0x146009,_0x27fc7f);_0x4d9a1d(_0x27fc7f);});});}exports[_0x395d('0x12')]=function(_0x291d0e){var _0x15d021=this;return new Promise(function(_0x9466f5,_0x134155){return db[_0x395d('0x13')][_0x395d('0x14')]({'raw':_0x291d0e['options']?_0x291d0e['options'][_0x395d('0x15')]===undefined?!![]:![]:!![],'where':_0x291d0e[_0x395d('0x16')]?_0x291d0e[_0x395d('0x16')][_0x395d('0x17')]||null:null,'attributes':_0x291d0e[_0x395d('0x16')]?_0x291d0e['options'][_0x395d('0x18')]||null:null,'limit':_0x291d0e[_0x395d('0x16')]?_0x291d0e[_0x395d('0x16')][_0x395d('0x19')]||null:null,'include':_0x291d0e[_0x395d('0x16')]?_0x291d0e['options'][_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x291d0e['options'][_0x395d('0x1a')],function(_0x23003a){return{'model':db[_0x23003a[_0x395d('0x1c')]],'as':_0x23003a['as'],'attributes':_0x23003a[_0x395d('0x18')],'include':_0x23003a[_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x23003a[_0x395d('0x1a')],function(_0x58e68a){return{'model':db[_0x58e68a[_0x395d('0x1c')]],'as':_0x58e68a['as'],'attributes':_0x58e68a['attributes'],'include':_0x58e68a[_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x58e68a[_0x395d('0x1a')],function(_0x559ad3){return{'model':db[_0x559ad3[_0x395d('0x1c')]],'as':_0x559ad3['as'],'attributes':_0x559ad3[_0x395d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c519){logger['info'](_0x395d('0x12'),_0x291d0e);logger[_0x395d('0xc')](_0x395d('0x12'),_0x291d0e,JSON[_0x395d('0xd')](_0x43c519));_0x9466f5(_0x43c519);})['catch'](function(_0x58cc51){logger[_0x395d('0xe')](_0x395d('0x12'),_0x58cc51['message'],_0x291d0e);_0x134155(_0x15d021[_0x395d('0xe')](0x1f4,_0x58cc51['message']));});});};exports['ShowTrunk']=function(_0x2634cd){var _0x52c419=this;return new Promise(function(_0x3a3292,_0x5b618a){return db[_0x395d('0x13')]['find']({'raw':_0x2634cd['options']?_0x2634cd[_0x395d('0x16')][_0x395d('0x15')]===undefined?!![]:![]:!![],'where':_0x2634cd[_0x395d('0x16')]?_0x2634cd[_0x395d('0x16')][_0x395d('0x17')]||null:null,'attributes':_0x2634cd['options']?_0x2634cd[_0x395d('0x16')][_0x395d('0x18')]||null:null,'include':_0x2634cd[_0x395d('0x16')]?_0x2634cd['options'][_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x2634cd[_0x395d('0x16')][_0x395d('0x1a')],function(_0x39c0ce){return{'model':db[_0x39c0ce[_0x395d('0x1c')]],'as':_0x39c0ce['as'],'attributes':_0x39c0ce[_0x395d('0x18')],'include':_0x39c0ce[_0x395d('0x1a')]?_['map'](_0x39c0ce[_0x395d('0x1a')],function(_0x5f3498){return{'model':db[_0x5f3498[_0x395d('0x1c')]],'as':_0x5f3498['as'],'attributes':_0x5f3498['attributes'],'include':_0x5f3498['include']?_[_0x395d('0x1b')](_0x5f3498['include'],function(_0x3f4de1){return{'model':db[_0x3f4de1['model']],'as':_0x3f4de1['as'],'attributes':_0x3f4de1[_0x395d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x395d('0x8')](function(_0x205d02){logger[_0x395d('0x9')]('ShowTrunk',_0x2634cd);logger[_0x395d('0xc')](_0x395d('0x1d'),_0x2634cd,JSON[_0x395d('0xd')](_0x205d02));_0x3a3292(_0x205d02);})[_0x395d('0x1e')](function(_0xe1ae2f){logger['error'](_0x395d('0x1d'),_0xe1ae2f['message'],_0x2634cd);_0x5b618a(_0x52c419[_0x395d('0xe')](0x1f4,_0xe1ae2f['message']));});});};
\ No newline at end of file