Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / trunk / trunk.rpc.js
index c313a06..4696b90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb17f=['map','model','find','ShowTrunk','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include'];(function(_0x5285f9,_0x2bd7d7){var _0x6edc0c=function(_0x5ae671){while(--_0x5ae671){_0x5285f9['push'](_0x5285f9['shift']());}};_0x6edc0c(++_0x2bd7d7);}(_0xb17f,0x19c));var _0xfb17=function(_0x4ad0b4,_0x160ebc){_0x4ad0b4=_0x4ad0b4-0x0;var _0x11ebd8=_0xb17f[_0x4ad0b4];return _0x11ebd8;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var moment=require(_0xfb17('0x2'));var BPromise=require(_0xfb17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb17('0x4'));var logger=require(_0xfb17('0x5'))(_0xfb17('0x6'));var config=require(_0xfb17('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb17('0x8')][_0xfb17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205a73,_0x332a81,_0x1664ed){return new BPromise(function(_0x29f570,_0x3efa44){return client[_0xfb17('0xa')](_0x205a73,_0x1664ed)[_0xfb17('0xb')](function(_0x19ca80){logger[_0xfb17('0xc')](_0xfb17('0xd'),_0x332a81,'request\x20sent');logger[_0xfb17('0xe')](_0xfb17('0xf'),_0x332a81,_0xfb17('0x10'),JSON[_0xfb17('0x11')](_0x19ca80));if(_0x19ca80['error']){if(_0x19ca80[_0xfb17('0x12')][_0xfb17('0x13')]===0x1f4){logger[_0xfb17('0x12')](_0xfb17('0xd'),_0x332a81,_0x19ca80[_0xfb17('0x12')][_0xfb17('0x14')]);return _0x3efa44(_0x19ca80['error']['message']);}logger[_0xfb17('0x12')]('Trunk,\x20%s,\x20%s',_0x332a81,_0x19ca80[_0xfb17('0x12')][_0xfb17('0x14')]);return _0x29f570(_0x19ca80[_0xfb17('0x12')][_0xfb17('0x14')]);}else{logger[_0xfb17('0xc')]('Trunk,\x20%s,\x20%s',_0x332a81,_0xfb17('0x10'));_0x29f570(_0x19ca80['result'][_0xfb17('0x14')]);}})['catch'](function(_0x2ca980){logger[_0xfb17('0x12')](_0xfb17('0xd'),_0x332a81,_0x2ca980);_0x3efa44(_0x2ca980);});});}exports[_0xfb17('0x15')]=function(_0x49b8f){var _0x56dda7=this;return new Promise(function(_0x560e8d,_0x56f20b){return db[_0xfb17('0x16')][_0xfb17('0x17')]({'raw':_0x49b8f[_0xfb17('0x18')]?_0x49b8f[_0xfb17('0x18')][_0xfb17('0x19')]===undefined?!![]:![]:!![],'where':_0x49b8f[_0xfb17('0x18')]?_0x49b8f['options'][_0xfb17('0x1a')]||null:null,'attributes':_0x49b8f[_0xfb17('0x18')]?_0x49b8f[_0xfb17('0x18')][_0xfb17('0x1b')]||null:null,'limit':_0x49b8f['options']?_0x49b8f['options'][_0xfb17('0x1c')]||null:null,'include':_0x49b8f[_0xfb17('0x18')]?_0x49b8f['options'][_0xfb17('0x1d')]?_[_0xfb17('0x1e')](_0x49b8f[_0xfb17('0x18')][_0xfb17('0x1d')],function(_0x3ba21c){return{'model':db[_0x3ba21c['model']],'as':_0x3ba21c['as'],'attributes':_0x3ba21c['attributes'],'include':_0x3ba21c[_0xfb17('0x1d')]?_[_0xfb17('0x1e')](_0x3ba21c[_0xfb17('0x1d')],function(_0x812b20){return{'model':db[_0x812b20[_0xfb17('0x1f')]],'as':_0x812b20['as'],'attributes':_0x812b20[_0xfb17('0x1b')],'include':_0x812b20[_0xfb17('0x1d')]?_[_0xfb17('0x1e')](_0x812b20[_0xfb17('0x1d')],function(_0x55776d){return{'model':db[_0x55776d[_0xfb17('0x1f')]],'as':_0x55776d['as'],'attributes':_0x55776d[_0xfb17('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb17('0xb')](function(_0x1670f2){logger[_0xfb17('0xc')](_0xfb17('0x15'),_0x49b8f);logger[_0xfb17('0xe')]('GetTrunk',_0x49b8f,JSON['stringify'](_0x1670f2));_0x560e8d(_0x1670f2);})['catch'](function(_0x476f87){logger[_0xfb17('0x12')]('GetTrunk',_0x476f87['message'],_0x49b8f);_0x56f20b(_0x56dda7['error'](0x1f4,_0x476f87[_0xfb17('0x14')]));});});};exports['ShowTrunk']=function(_0x43c298){var _0x56d6c4=this;return new Promise(function(_0x36781e,_0x1b719b){return db[_0xfb17('0x16')][_0xfb17('0x20')]({'raw':_0x43c298[_0xfb17('0x18')]?_0x43c298['options'][_0xfb17('0x19')]===undefined?!![]:![]:!![],'where':_0x43c298[_0xfb17('0x18')]?_0x43c298['options'][_0xfb17('0x1a')]||null:null,'attributes':_0x43c298[_0xfb17('0x18')]?_0x43c298[_0xfb17('0x18')]['attributes']||null:null,'include':_0x43c298['options']?_0x43c298['options']['include']?_[_0xfb17('0x1e')](_0x43c298[_0xfb17('0x18')][_0xfb17('0x1d')],function(_0x24bd1b){return{'model':db[_0x24bd1b['model']],'as':_0x24bd1b['as'],'attributes':_0x24bd1b['attributes'],'include':_0x24bd1b['include']?_[_0xfb17('0x1e')](_0x24bd1b['include'],function(_0xf652f8){return{'model':db[_0xf652f8[_0xfb17('0x1f')]],'as':_0xf652f8['as'],'attributes':_0xf652f8[_0xfb17('0x1b')],'include':_0xf652f8[_0xfb17('0x1d')]?_['map'](_0xf652f8['include'],function(_0xca8a6e){return{'model':db[_0xca8a6e[_0xfb17('0x1f')]],'as':_0xca8a6e['as'],'attributes':_0xca8a6e[_0xfb17('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb17('0xb')](function(_0x26a2a8){logger[_0xfb17('0xc')](_0xfb17('0x21'),_0x43c298);logger[_0xfb17('0xe')](_0xfb17('0x21'),_0x43c298,JSON[_0xfb17('0x11')](_0x26a2a8));_0x36781e(_0x26a2a8);})['catch'](function(_0x5ecdbb){logger[_0xfb17('0x12')](_0xfb17('0x21'),_0x5ecdbb[_0xfb17('0x14')],_0x43c298);_0x1b719b(_0x56d6c4[_0xfb17('0x12')](0x1f4,_0x5ecdbb[_0xfb17('0x14')]));});});};
\ No newline at end of file
+var _0xb6be=['request','info','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','map','include','model','then','GetTrunk','ShowTrunk','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x51ec30,_0x1904c4){var _0xabcc01=function(_0x5497a8){while(--_0x5497a8){_0x51ec30['push'](_0x51ec30['shift']());}};_0xabcc01(++_0x1904c4);}(_0xb6be,0x1c7));var _0xeb6b=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb6be[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xeb6b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeb6b('0x1'));var rs=require(_0xeb6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb6b('0x3'))['db'];var utils=require(_0xeb6b('0x4'));var logger=require(_0xeb6b('0x5'))('rpc');var config=require(_0xeb6b('0x6'));var jayson=require(_0xeb6b('0x7'));var client=jayson[_0xeb6b('0x8')][_0xeb6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25d461,_0x81d32b,_0x3ff0d9){return new BPromise(function(_0x15c753,_0xc5bcff){return client[_0xeb6b('0xa')](_0x25d461,_0x3ff0d9)['then'](function(_0x2ad90c){logger[_0xeb6b('0xb')]('Trunk,\x20%s,\x20%s',_0x81d32b,_0xeb6b('0xc'));logger[_0xeb6b('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x81d32b,_0xeb6b('0xc'),JSON[_0xeb6b('0xe')](_0x2ad90c));if(_0x2ad90c[_0xeb6b('0xf')]){if(_0x2ad90c[_0xeb6b('0xf')]['code']===0x1f4){logger[_0xeb6b('0xf')](_0xeb6b('0x10'),_0x81d32b,_0x2ad90c[_0xeb6b('0xf')][_0xeb6b('0x11')]);return _0xc5bcff(_0x2ad90c[_0xeb6b('0xf')][_0xeb6b('0x11')]);}logger[_0xeb6b('0xf')](_0xeb6b('0x10'),_0x81d32b,_0x2ad90c[_0xeb6b('0xf')]['message']);return _0x15c753(_0x2ad90c[_0xeb6b('0xf')]['message']);}else{logger[_0xeb6b('0xb')](_0xeb6b('0x10'),_0x81d32b,_0xeb6b('0xc'));_0x15c753(_0x2ad90c['result']['message']);}})[_0xeb6b('0x12')](function(_0x5e2f48){logger[_0xeb6b('0xf')]('Trunk,\x20%s,\x20%s',_0x81d32b,_0x5e2f48);_0xc5bcff(_0x5e2f48);});});}exports['GetTrunk']=function(_0x7ecbbf){var _0x1edf17=this;return new Promise(function(_0x4d99e5,_0x2b0259){return db['Trunk']['findAll']({'raw':_0x7ecbbf['options']?_0x7ecbbf[_0xeb6b('0x13')][_0xeb6b('0x14')]===undefined?!![]:![]:!![],'where':_0x7ecbbf[_0xeb6b('0x13')]?_0x7ecbbf[_0xeb6b('0x13')][_0xeb6b('0x15')]||null:null,'attributes':_0x7ecbbf[_0xeb6b('0x13')]?_0x7ecbbf[_0xeb6b('0x13')][_0xeb6b('0x16')]||null:null,'limit':_0x7ecbbf[_0xeb6b('0x13')]?_0x7ecbbf[_0xeb6b('0x13')][_0xeb6b('0x17')]||null:null,'include':_0x7ecbbf['options']?_0x7ecbbf['options']['include']?_[_0xeb6b('0x18')](_0x7ecbbf[_0xeb6b('0x13')][_0xeb6b('0x19')],function(_0x1ab9f9){return{'model':db[_0x1ab9f9['model']],'as':_0x1ab9f9['as'],'attributes':_0x1ab9f9['attributes'],'include':_0x1ab9f9[_0xeb6b('0x19')]?_['map'](_0x1ab9f9[_0xeb6b('0x19')],function(_0x2dfc09){return{'model':db[_0x2dfc09[_0xeb6b('0x1a')]],'as':_0x2dfc09['as'],'attributes':_0x2dfc09['attributes'],'include':_0x2dfc09[_0xeb6b('0x19')]?_[_0xeb6b('0x18')](_0x2dfc09[_0xeb6b('0x19')],function(_0x245131){return{'model':db[_0x245131[_0xeb6b('0x1a')]],'as':_0x245131['as'],'attributes':_0x245131[_0xeb6b('0x16')]};}):[]};}):[]};}):[]:[]})[_0xeb6b('0x1b')](function(_0x354d2c){logger[_0xeb6b('0xb')]('GetTrunk',_0x7ecbbf);logger['debug'](_0xeb6b('0x1c'),_0x7ecbbf,JSON[_0xeb6b('0xe')](_0x354d2c));_0x4d99e5(_0x354d2c);})[_0xeb6b('0x12')](function(_0x2b7052){logger['error'](_0xeb6b('0x1c'),_0x2b7052[_0xeb6b('0x11')],_0x7ecbbf);_0x2b0259(_0x1edf17[_0xeb6b('0xf')](0x1f4,_0x2b7052[_0xeb6b('0x11')]));});});};exports[_0xeb6b('0x1d')]=function(_0x4772dd){var _0x11c560=this;return new Promise(function(_0x11183a,_0x1d6916){return db['Trunk'][_0xeb6b('0x1e')]({'raw':_0x4772dd[_0xeb6b('0x13')]?_0x4772dd[_0xeb6b('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x4772dd[_0xeb6b('0x13')]?_0x4772dd[_0xeb6b('0x13')][_0xeb6b('0x15')]||null:null,'attributes':_0x4772dd[_0xeb6b('0x13')]?_0x4772dd['options'][_0xeb6b('0x16')]||null:null,'include':_0x4772dd[_0xeb6b('0x13')]?_0x4772dd[_0xeb6b('0x13')][_0xeb6b('0x19')]?_[_0xeb6b('0x18')](_0x4772dd[_0xeb6b('0x13')][_0xeb6b('0x19')],function(_0x475733){return{'model':db[_0x475733[_0xeb6b('0x1a')]],'as':_0x475733['as'],'attributes':_0x475733[_0xeb6b('0x16')],'include':_0x475733['include']?_[_0xeb6b('0x18')](_0x475733['include'],function(_0x298dc6){return{'model':db[_0x298dc6['model']],'as':_0x298dc6['as'],'attributes':_0x298dc6[_0xeb6b('0x16')],'include':_0x298dc6[_0xeb6b('0x19')]?_[_0xeb6b('0x18')](_0x298dc6[_0xeb6b('0x19')],function(_0x287aa7){return{'model':db[_0x287aa7[_0xeb6b('0x1a')]],'as':_0x287aa7['as'],'attributes':_0x287aa7[_0xeb6b('0x16')]};}):[]};}):[]};}):[]:[]})[_0xeb6b('0x1b')](function(_0x406f7e){logger[_0xeb6b('0xb')]('ShowTrunk',_0x4772dd);logger[_0xeb6b('0xd')](_0xeb6b('0x1d'),_0x4772dd,JSON[_0xeb6b('0xe')](_0x406f7e));_0x11183a(_0x406f7e);})[_0xeb6b('0x12')](function(_0x55e912){logger['error']('ShowTrunk',_0x55e912['message'],_0x4772dd);_0x1d6916(_0x11c560[_0xeb6b('0xf')](0x1f4,_0x55e912[_0xeb6b('0x11')]));});});};
\ No newline at end of file