Built motion from commit f67b3b02.|2.6.31
[motion2.git] / server / api / trunk / trunk.rpc.js
index 0f7a388..bca5fdb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62a2=['options','raw','where','attributes','limit','include','map','model','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','findAll'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0x62a2,0x14d));var _0x262a=function(_0xef9903,_0x1f6af1){_0xef9903=_0xef9903-0x0;var _0x4db20e=_0x62a2[_0xef9903];return _0x4db20e;};'use strict';var _=require(_0x262a('0x0'));var util=require(_0x262a('0x1'));var moment=require(_0x262a('0x2'));var BPromise=require(_0x262a('0x3'));var rs=require(_0x262a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x262a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x262a('0x6'))(_0x262a('0x7'));var config=require(_0x262a('0x8'));var jayson=require(_0x262a('0x9'));var client=jayson[_0x262a('0xa')][_0x262a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ff060,_0x5a70b9,_0x5e6444){return new BPromise(function(_0x50519f,_0x427d0f){return client[_0x262a('0xc')](_0x4ff060,_0x5e6444)[_0x262a('0xd')](function(_0x37b534){logger[_0x262a('0xe')](_0x262a('0xf'),_0x5a70b9,_0x262a('0x10'));logger[_0x262a('0x11')](_0x262a('0x12'),_0x5a70b9,_0x262a('0x10'),JSON[_0x262a('0x13')](_0x37b534));if(_0x37b534[_0x262a('0x14')]){if(_0x37b534[_0x262a('0x14')][_0x262a('0x15')]===0x1f4){logger[_0x262a('0x14')](_0x262a('0xf'),_0x5a70b9,_0x37b534['error'][_0x262a('0x16')]);return _0x427d0f(_0x37b534[_0x262a('0x14')]['message']);}logger[_0x262a('0x14')](_0x262a('0xf'),_0x5a70b9,_0x37b534[_0x262a('0x14')][_0x262a('0x16')]);return _0x50519f(_0x37b534[_0x262a('0x14')]['message']);}else{logger[_0x262a('0xe')](_0x262a('0xf'),_0x5a70b9,_0x262a('0x10'));_0x50519f(_0x37b534[_0x262a('0x17')]['message']);}})[_0x262a('0x18')](function(_0xbb6432){logger[_0x262a('0x14')](_0x262a('0xf'),_0x5a70b9,_0xbb6432);_0x427d0f(_0xbb6432);});});}exports[_0x262a('0x19')]=function(_0x53e664){var _0x5146ce=this;return new Promise(function(_0x1eb1c3,_0x1992bf){return db['Trunk'][_0x262a('0x1a')]({'raw':_0x53e664[_0x262a('0x1b')]?_0x53e664['options'][_0x262a('0x1c')]===undefined?!![]:![]:!![],'where':_0x53e664[_0x262a('0x1b')]?_0x53e664['options'][_0x262a('0x1d')]||null:null,'attributes':_0x53e664[_0x262a('0x1b')]?_0x53e664[_0x262a('0x1b')][_0x262a('0x1e')]||null:null,'limit':_0x53e664[_0x262a('0x1b')]?_0x53e664['options'][_0x262a('0x1f')]||null:null,'include':_0x53e664[_0x262a('0x1b')]?_0x53e664[_0x262a('0x1b')][_0x262a('0x20')]?_[_0x262a('0x21')](_0x53e664[_0x262a('0x1b')][_0x262a('0x20')],function(_0xba9097){return{'model':db[_0xba9097[_0x262a('0x22')]],'as':_0xba9097['as'],'attributes':_0xba9097[_0x262a('0x1e')],'include':_0xba9097['include']?_[_0x262a('0x21')](_0xba9097['include'],function(_0x3a7162){return{'model':db[_0x3a7162['model']],'as':_0x3a7162['as'],'attributes':_0x3a7162['attributes'],'include':_0x3a7162['include']?_[_0x262a('0x21')](_0x3a7162[_0x262a('0x20')],function(_0x1857ec){return{'model':db[_0x1857ec[_0x262a('0x22')]],'as':_0x1857ec['as'],'attributes':_0x1857ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x262a('0xd')](function(_0x228bd2){logger[_0x262a('0xe')](_0x262a('0x19'),_0x53e664);logger[_0x262a('0x11')]('GetTrunk',_0x53e664,JSON['stringify'](_0x228bd2));_0x1eb1c3(_0x228bd2);})[_0x262a('0x18')](function(_0x22e6ce){logger[_0x262a('0x14')](_0x262a('0x19'),_0x22e6ce[_0x262a('0x16')],_0x53e664);_0x1992bf(_0x5146ce['error'](0x1f4,_0x22e6ce[_0x262a('0x16')]));});});};exports[_0x262a('0x23')]=function(_0x43f3f1){var _0x468cca=this;return new Promise(function(_0x3bd49c,_0x52da44){return db['Trunk']['find']({'raw':_0x43f3f1[_0x262a('0x1b')]?_0x43f3f1[_0x262a('0x1b')][_0x262a('0x1c')]===undefined?!![]:![]:!![],'where':_0x43f3f1['options']?_0x43f3f1['options'][_0x262a('0x1d')]||null:null,'attributes':_0x43f3f1['options']?_0x43f3f1['options'][_0x262a('0x1e')]||null:null,'include':_0x43f3f1[_0x262a('0x1b')]?_0x43f3f1[_0x262a('0x1b')][_0x262a('0x20')]?_[_0x262a('0x21')](_0x43f3f1['options'][_0x262a('0x20')],function(_0x53a0b1){return{'model':db[_0x53a0b1[_0x262a('0x22')]],'as':_0x53a0b1['as'],'attributes':_0x53a0b1[_0x262a('0x1e')],'include':_0x53a0b1[_0x262a('0x20')]?_['map'](_0x53a0b1[_0x262a('0x20')],function(_0x356ccf){return{'model':db[_0x356ccf[_0x262a('0x22')]],'as':_0x356ccf['as'],'attributes':_0x356ccf[_0x262a('0x1e')],'include':_0x356ccf['include']?_['map'](_0x356ccf[_0x262a('0x20')],function(_0x32d307){return{'model':db[_0x32d307[_0x262a('0x22')]],'as':_0x32d307['as'],'attributes':_0x32d307[_0x262a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf369){logger['info'](_0x262a('0x23'),_0x43f3f1);logger[_0x262a('0x11')](_0x262a('0x23'),_0x43f3f1,JSON[_0x262a('0x13')](_0x3bf369));_0x3bd49c(_0x3bf369);})[_0x262a('0x18')](function(_0x103797){logger[_0x262a('0x14')](_0x262a('0x23'),_0x103797['message'],_0x43f3f1);_0x52da44(_0x468cca[_0x262a('0x14')](0x1f4,_0x103797[_0x262a('0x16')]));});});};
\ No newline at end of file
+var _0x7ed2=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38dd06,_0x3edf66){var _0x3c6312=function(_0x3491cc){while(--_0x3491cc){_0x38dd06['push'](_0x38dd06['shift']());}};_0x3c6312(++_0x3edf66);}(_0x7ed2,0x1ed));var _0x27ed=function(_0x575c02,_0x18e3ce){_0x575c02=_0x575c02-0x0;var _0x1d9fdc=_0x7ed2[_0x575c02];return _0x1d9fdc;};'use strict';var _=require(_0x27ed('0x0'));var util=require(_0x27ed('0x1'));var moment=require('moment');var BPromise=require(_0x27ed('0x2'));var rs=require(_0x27ed('0x3'));var fs=require('fs');var Redis=require(_0x27ed('0x4'));var db=require(_0x27ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x27ed('0x6'))(_0x27ed('0x7'));var config=require(_0x27ed('0x8'));var jayson=require(_0x27ed('0x9'));var client=jayson[_0x27ed('0xa')][_0x27ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32fb45,_0x3a03e2,_0x41e603){return new BPromise(function(_0x220dcb,_0x125187){return client['request'](_0x32fb45,_0x41e603)[_0x27ed('0xc')](function(_0x15ecb9){logger[_0x27ed('0xd')](_0x27ed('0xe'),_0x3a03e2,_0x27ed('0xf'));logger[_0x27ed('0x10')](_0x27ed('0x11'),_0x3a03e2,_0x27ed('0xf'),JSON[_0x27ed('0x12')](_0x15ecb9));if(_0x15ecb9[_0x27ed('0x13')]){if(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x14')]===0x1f4){logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);return _0x125187(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);}logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x15ecb9[_0x27ed('0x13')]['message']);return _0x220dcb(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);}else{logger[_0x27ed('0xd')]('Trunk,\x20%s,\x20%s',_0x3a03e2,_0x27ed('0xf'));_0x220dcb(_0x15ecb9['result']['message']);}})[_0x27ed('0x16')](function(_0x4cdb7b){logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x4cdb7b);_0x125187(_0x4cdb7b);});});}exports[_0x27ed('0x17')]=function(_0x3ab3b6){var _0x2629f8=this;return new Promise(function(_0x23a830,_0x15bfe9){return db[_0x27ed('0x18')]['findAll']({'raw':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1b')]||null:null,'attributes':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6['options'][_0x27ed('0x1c')]||null:null,'limit':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6['options'][_0x27ed('0x1d')]||null:null,'include':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1e')]?_['map'](_0x3ab3b6['options'][_0x27ed('0x1e')],function(_0x238883){return{'model':db[_0x238883[_0x27ed('0x1f')]],'as':_0x238883['as'],'attributes':_0x238883['attributes'],'include':_0x238883[_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x238883[_0x27ed('0x1e')],function(_0x58757b){return{'model':db[_0x58757b[_0x27ed('0x1f')]],'as':_0x58757b['as'],'attributes':_0x58757b[_0x27ed('0x1c')],'include':_0x58757b[_0x27ed('0x1e')]?_['map'](_0x58757b['include'],function(_0x379b14){return{'model':db[_0x379b14['model']],'as':_0x379b14['as'],'attributes':_0x379b14[_0x27ed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x876c47){logger[_0x27ed('0xd')](_0x27ed('0x17'),_0x3ab3b6);logger[_0x27ed('0x10')](_0x27ed('0x17'),_0x3ab3b6,JSON[_0x27ed('0x12')](_0x876c47));_0x23a830(_0x876c47);})[_0x27ed('0x16')](function(_0x2646f8){logger[_0x27ed('0x13')](_0x27ed('0x17'),_0x2646f8[_0x27ed('0x15')],_0x3ab3b6);_0x15bfe9(_0x2629f8[_0x27ed('0x13')](0x1f4,_0x2646f8[_0x27ed('0x15')]));});});};exports[_0x27ed('0x21')]=function(_0x53564a){var _0x5b2cd2=this;return new Promise(function(_0x29fcaa,_0x357902){return db[_0x27ed('0x18')]['find']({'raw':_0x53564a['options']?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x53564a[_0x27ed('0x19')]?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1b')]||null:null,'attributes':_0x53564a[_0x27ed('0x19')]?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1c')]||null:null,'include':_0x53564a[_0x27ed('0x19')]?_0x53564a['options'][_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x53564a['options'][_0x27ed('0x1e')],function(_0x2b31ba){return{'model':db[_0x2b31ba['model']],'as':_0x2b31ba['as'],'attributes':_0x2b31ba[_0x27ed('0x1c')],'include':_0x2b31ba[_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x2b31ba['include'],function(_0x3163c0){return{'model':db[_0x3163c0['model']],'as':_0x3163c0['as'],'attributes':_0x3163c0[_0x27ed('0x1c')],'include':_0x3163c0['include']?_[_0x27ed('0x20')](_0x3163c0[_0x27ed('0x1e')],function(_0x191fc2){return{'model':db[_0x191fc2[_0x27ed('0x1f')]],'as':_0x191fc2['as'],'attributes':_0x191fc2[_0x27ed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x27ed('0xc')](function(_0x4cec45){logger[_0x27ed('0xd')](_0x27ed('0x21'),_0x53564a);logger['debug'](_0x27ed('0x21'),_0x53564a,JSON[_0x27ed('0x12')](_0x4cec45));_0x29fcaa(_0x4cec45);})[_0x27ed('0x16')](function(_0x276570){logger[_0x27ed('0x13')]('ShowTrunk',_0x276570[_0x27ed('0x15')],_0x53564a);_0x357902(_0x5b2cd2['error'](0x1f4,_0x276570[_0x27ed('0x15')]));});});};
\ No newline at end of file