Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / template / template.rpc.js
index d0b2fe7..1168103 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7df=['model','attributes','map','debug','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','limit','include'];(function(_0x1c6e88,_0x48df00){var _0x55c634=function(_0x4741bf){while(--_0x4741bf){_0x1c6e88['push'](_0x1c6e88['shift']());}};_0x55c634(++_0x48df00);}(_0xf7df,0x11d));var _0xff7d=function(_0x25c3a7,_0x3b8711){_0x25c3a7=_0x25c3a7-0x0;var _0x3ecd01=_0xf7df[_0x25c3a7];return _0x3ecd01;};'use strict';var _=require('lodash');var util=require(_0xff7d('0x0'));var moment=require('moment');var BPromise=require(_0xff7d('0x1'));var rs=require(_0xff7d('0x2'));var fs=require('fs');var Redis=require(_0xff7d('0x3'));var db=require(_0xff7d('0x4'))['db'];var utils=require(_0xff7d('0x5'));var logger=require(_0xff7d('0x6'))(_0xff7d('0x7'));var config=require(_0xff7d('0x8'));var jayson=require(_0xff7d('0x9'));var client=jayson['client'][_0xff7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad3e9,_0x2ff094,_0x41279b){return new BPromise(function(_0x33185f,_0x35cad2){return client[_0xff7d('0xb')](_0x3ad3e9,_0x41279b)[_0xff7d('0xc')](function(_0x17590d){logger[_0xff7d('0xd')]('Template,\x20%s,\x20%s',_0x2ff094,_0xff7d('0xe'));logger['debug'](_0xff7d('0xf'),_0x2ff094,_0xff7d('0xe'),JSON[_0xff7d('0x10')](_0x17590d));if(_0x17590d['error']){if(_0x17590d['error'][_0xff7d('0x11')]===0x1f4){logger[_0xff7d('0x12')](_0xff7d('0x13'),_0x2ff094,_0x17590d['error'][_0xff7d('0x14')]);return _0x35cad2(_0x17590d[_0xff7d('0x12')]['message']);}logger['error'](_0xff7d('0x13'),_0x2ff094,_0x17590d[_0xff7d('0x12')][_0xff7d('0x14')]);return _0x33185f(_0x17590d[_0xff7d('0x12')][_0xff7d('0x14')]);}else{logger[_0xff7d('0xd')](_0xff7d('0x13'),_0x2ff094,_0xff7d('0xe'));_0x33185f(_0x17590d[_0xff7d('0x15')][_0xff7d('0x14')]);}})['catch'](function(_0x53a682){logger['error'](_0xff7d('0x13'),_0x2ff094,_0x53a682);_0x35cad2(_0x53a682);});});}exports[_0xff7d('0x16')]=function(_0x17b516){var _0x1fbb31=this;return new Promise(function(_0x135c9a,_0x1d2f30){return db[_0xff7d('0x17')][_0xff7d('0x18')]({'raw':_0x17b516[_0xff7d('0x19')]?_0x17b516[_0xff7d('0x19')][_0xff7d('0x1a')]===undefined?!![]:![]:!![],'where':_0x17b516[_0xff7d('0x19')]?_0x17b516[_0xff7d('0x19')][_0xff7d('0x1b')]||null:null,'attributes':_0x17b516['options']?_0x17b516[_0xff7d('0x19')]['attributes']||null:null,'limit':_0x17b516[_0xff7d('0x19')]?_0x17b516[_0xff7d('0x19')][_0xff7d('0x1c')]||null:null,'include':_0x17b516['options']?_0x17b516['options'][_0xff7d('0x1d')]?_['map'](_0x17b516['options']['include'],function(_0x276a20){return{'model':db[_0x276a20[_0xff7d('0x1e')]],'as':_0x276a20['as'],'attributes':_0x276a20[_0xff7d('0x1f')],'include':_0x276a20[_0xff7d('0x1d')]?_['map'](_0x276a20[_0xff7d('0x1d')],function(_0x75a52b){return{'model':db[_0x75a52b[_0xff7d('0x1e')]],'as':_0x75a52b['as'],'attributes':_0x75a52b[_0xff7d('0x1f')],'include':_0x75a52b[_0xff7d('0x1d')]?_[_0xff7d('0x20')](_0x75a52b[_0xff7d('0x1d')],function(_0x300040){return{'model':db[_0x300040[_0xff7d('0x1e')]],'as':_0x300040['as'],'attributes':_0x300040['attributes']};}):[]};}):[]};}):[]:[]})[_0xff7d('0xc')](function(_0x4fdc1f){logger[_0xff7d('0xd')](_0xff7d('0x16'),_0x17b516);logger[_0xff7d('0x21')]('GetTemplate',_0x17b516,JSON[_0xff7d('0x10')](_0x4fdc1f));_0x135c9a(_0x4fdc1f);})[_0xff7d('0x22')](function(_0x445be2){logger[_0xff7d('0x12')](_0xff7d('0x16'),_0x445be2[_0xff7d('0x14')],_0x17b516);_0x1d2f30(_0x1fbb31[_0xff7d('0x12')](0x1f4,_0x445be2[_0xff7d('0x14')]));});});};
\ No newline at end of file
+var _0xa339=['limit','include','model','map','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','options','raw','where','attributes'];(function(_0x4e4245,_0x18fda2){var _0x4f0435=function(_0x1272a5){while(--_0x1272a5){_0x4e4245['push'](_0x4e4245['shift']());}};_0x4f0435(++_0x18fda2);}(_0xa339,0xac));var _0x9a33=function(_0x556081,_0x5c6fb4){_0x556081=_0x556081-0x0;var _0x5872bf=_0xa339[_0x556081];return _0x5872bf;};'use strict';var _=require('lodash');var util=require(_0x9a33('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a33('0x1'));var fs=require('fs');var Redis=require(_0x9a33('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a33('0x3'));var logger=require(_0x9a33('0x4'))('rpc');var config=require(_0x9a33('0x5'));var jayson=require(_0x9a33('0x6'));var client=jayson['client'][_0x9a33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2944f5,_0x4afaf3,_0x466d39){return new BPromise(function(_0x5b0ac4,_0x256b4d){return client['request'](_0x2944f5,_0x466d39)[_0x9a33('0x8')](function(_0x115a0e){logger[_0x9a33('0x9')]('Template,\x20%s,\x20%s',_0x4afaf3,_0x9a33('0xa'));logger[_0x9a33('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x4afaf3,_0x9a33('0xa'),JSON[_0x9a33('0xc')](_0x115a0e));if(_0x115a0e[_0x9a33('0xd')]){if(_0x115a0e['error'][_0x9a33('0xe')]===0x1f4){logger[_0x9a33('0xd')](_0x9a33('0xf'),_0x4afaf3,_0x115a0e[_0x9a33('0xd')][_0x9a33('0x10')]);return _0x256b4d(_0x115a0e[_0x9a33('0xd')]['message']);}logger[_0x9a33('0xd')](_0x9a33('0xf'),_0x4afaf3,_0x115a0e[_0x9a33('0xd')][_0x9a33('0x10')]);return _0x5b0ac4(_0x115a0e[_0x9a33('0xd')][_0x9a33('0x10')]);}else{logger['info'](_0x9a33('0xf'),_0x4afaf3,_0x9a33('0xa'));_0x5b0ac4(_0x115a0e['result'][_0x9a33('0x10')]);}})[_0x9a33('0x11')](function(_0x28d8cb){logger['error'](_0x9a33('0xf'),_0x4afaf3,_0x28d8cb);_0x256b4d(_0x28d8cb);});});}exports[_0x9a33('0x12')]=function(_0x47532f){var _0x1ff692=this;return new Promise(function(_0x5d1b38,_0x14b1d6){return db[_0x9a33('0x13')]['findAll']({'raw':_0x47532f[_0x9a33('0x14')]?_0x47532f['options'][_0x9a33('0x15')]===undefined?!![]:![]:!![],'where':_0x47532f['options']?_0x47532f[_0x9a33('0x14')][_0x9a33('0x16')]||null:null,'attributes':_0x47532f[_0x9a33('0x14')]?_0x47532f[_0x9a33('0x14')][_0x9a33('0x17')]||null:null,'limit':_0x47532f[_0x9a33('0x14')]?_0x47532f['options'][_0x9a33('0x18')]||null:null,'include':_0x47532f['options']?_0x47532f[_0x9a33('0x14')][_0x9a33('0x19')]?_['map'](_0x47532f[_0x9a33('0x14')][_0x9a33('0x19')],function(_0x5c23ad){return{'model':db[_0x5c23ad[_0x9a33('0x1a')]],'as':_0x5c23ad['as'],'attributes':_0x5c23ad[_0x9a33('0x17')],'include':_0x5c23ad[_0x9a33('0x19')]?_['map'](_0x5c23ad[_0x9a33('0x19')],function(_0x3ac2ee){return{'model':db[_0x3ac2ee[_0x9a33('0x1a')]],'as':_0x3ac2ee['as'],'attributes':_0x3ac2ee[_0x9a33('0x17')],'include':_0x3ac2ee[_0x9a33('0x19')]?_[_0x9a33('0x1b')](_0x3ac2ee[_0x9a33('0x19')],function(_0x2de559){return{'model':db[_0x2de559['model']],'as':_0x2de559['as'],'attributes':_0x2de559[_0x9a33('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da89f){logger[_0x9a33('0x9')](_0x9a33('0x12'),_0x47532f);logger[_0x9a33('0xb')](_0x9a33('0x12'),_0x47532f,JSON[_0x9a33('0xc')](_0x1da89f));_0x5d1b38(_0x1da89f);})[_0x9a33('0x11')](function(_0x3640c5){logger[_0x9a33('0xd')](_0x9a33('0x12'),_0x3640c5[_0x9a33('0x10')],_0x47532f);_0x14b1d6(_0x1ff692['error'](0x1f4,_0x3640c5['message']));});});};
\ No newline at end of file