Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / template / template.rpc.js
index 583f9d1..5665858 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf13=['request\x20sent','stringify','error','code','message','result','GetTemplate','Template','options','raw','where','limit','include','map','model','attributes','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','client','request','then','info','Template,\x20%s,\x20%s'];(function(_0x2e63c3,_0x28fcb0){var _0x3d259b=function(_0x537542){while(--_0x537542){_0x2e63c3['push'](_0x2e63c3['shift']());}};_0x3d259b(++_0x28fcb0);}(_0xbf13,0x1e1));var _0x3bf1=function(_0x527058,_0x297d58){_0x527058=_0x527058-0x0;var _0x3d7ef5=_0xbf13[_0x527058];return _0x3d7ef5;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bf1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bf1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281163,_0xf6291e,_0xc61f1a){return new BPromise(function(_0x5f0116,_0x38c623){return client[_0x3bf1('0x8')](_0x281163,_0xc61f1a)[_0x3bf1('0x9')](function(_0x31d2c9){logger[_0x3bf1('0xa')](_0x3bf1('0xb'),_0xf6291e,_0x3bf1('0xc'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0xf6291e,_0x3bf1('0xc'),JSON[_0x3bf1('0xd')](_0x31d2c9));if(_0x31d2c9['error']){if(_0x31d2c9[_0x3bf1('0xe')][_0x3bf1('0xf')]===0x1f4){logger[_0x3bf1('0xe')]('Template,\x20%s,\x20%s',_0xf6291e,_0x31d2c9['error'][_0x3bf1('0x10')]);return _0x38c623(_0x31d2c9[_0x3bf1('0xe')][_0x3bf1('0x10')]);}logger[_0x3bf1('0xe')](_0x3bf1('0xb'),_0xf6291e,_0x31d2c9[_0x3bf1('0xe')][_0x3bf1('0x10')]);return _0x5f0116(_0x31d2c9[_0x3bf1('0xe')]['message']);}else{logger['info'](_0x3bf1('0xb'),_0xf6291e,_0x3bf1('0xc'));_0x5f0116(_0x31d2c9[_0x3bf1('0x11')]['message']);}})['catch'](function(_0x403be0){logger['error']('Template,\x20%s,\x20%s',_0xf6291e,_0x403be0);_0x38c623(_0x403be0);});});}exports[_0x3bf1('0x12')]=function(_0x5ecd87){var _0x43388a=this;return new Promise(function(_0x4ba0df,_0x584986){return db[_0x3bf1('0x13')]['findAll']({'raw':_0x5ecd87[_0x3bf1('0x14')]?_0x5ecd87[_0x3bf1('0x14')][_0x3bf1('0x15')]===undefined?!![]:![]:!![],'where':_0x5ecd87[_0x3bf1('0x14')]?_0x5ecd87[_0x3bf1('0x14')][_0x3bf1('0x16')]||null:null,'attributes':_0x5ecd87[_0x3bf1('0x14')]?_0x5ecd87[_0x3bf1('0x14')]['attributes']||null:null,'limit':_0x5ecd87[_0x3bf1('0x14')]?_0x5ecd87['options'][_0x3bf1('0x17')]||null:null,'include':_0x5ecd87[_0x3bf1('0x14')]?_0x5ecd87[_0x3bf1('0x14')][_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x5ecd87[_0x3bf1('0x14')][_0x3bf1('0x18')],function(_0x194d06){return{'model':db[_0x194d06[_0x3bf1('0x1a')]],'as':_0x194d06['as'],'attributes':_0x194d06[_0x3bf1('0x1b')],'include':_0x194d06[_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x194d06[_0x3bf1('0x18')],function(_0x46bae6){return{'model':db[_0x46bae6['model']],'as':_0x46bae6['as'],'attributes':_0x46bae6[_0x3bf1('0x1b')],'include':_0x46bae6[_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x46bae6[_0x3bf1('0x18')],function(_0x1aa639){return{'model':db[_0x1aa639[_0x3bf1('0x1a')]],'as':_0x1aa639['as'],'attributes':_0x1aa639[_0x3bf1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3bf1('0x9')](function(_0x789e73){logger[_0x3bf1('0xa')](_0x3bf1('0x12'),_0x5ecd87);logger[_0x3bf1('0x1c')](_0x3bf1('0x12'),_0x5ecd87,JSON[_0x3bf1('0xd')](_0x789e73));_0x4ba0df(_0x789e73);})['catch'](function(_0x4fecec){logger['error'](_0x3bf1('0x12'),_0x4fecec['message'],_0x5ecd87);_0x584986(_0x43388a[_0x3bf1('0xe')](0x1f4,_0x4fecec['message']));});});};
\ No newline at end of file
+var _0xb7db=['raw','include','model','attributes','map','then','GetTemplate','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','options'];(function(_0x17d314,_0x4c6cc8){var _0x58e7d3=function(_0x33a2c3){while(--_0x33a2c3){_0x17d314['push'](_0x17d314['shift']());}};_0x58e7d3(++_0x4c6cc8);}(_0xb7db,0x1e7));var _0xbb7d=function(_0x5868cc,_0x41bd14){_0x5868cc=_0x5868cc-0x0;var _0x24d668=_0xb7db[_0x5868cc];return _0x24d668;};'use strict';var _=require(_0xbb7d('0x0'));var util=require(_0xbb7d('0x1'));var moment=require(_0xbb7d('0x2'));var BPromise=require(_0xbb7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb7d('0x4'));var db=require(_0xbb7d('0x5'))['db'];var utils=require(_0xbb7d('0x6'));var logger=require(_0xbb7d('0x7'))('rpc');var config=require(_0xbb7d('0x8'));var jayson=require(_0xbb7d('0x9'));var client=jayson['client'][_0xbb7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21aba4,_0x1da0bc,_0xc3d867){return new BPromise(function(_0x12b4b2,_0x15d257){return client[_0xbb7d('0xb')](_0x21aba4,_0xc3d867)['then'](function(_0x28d98d){logger['info'](_0xbb7d('0xc'),_0x1da0bc,'request\x20sent');logger[_0xbb7d('0xd')](_0xbb7d('0xe'),_0x1da0bc,_0xbb7d('0xf'),JSON[_0xbb7d('0x10')](_0x28d98d));if(_0x28d98d[_0xbb7d('0x11')]){if(_0x28d98d[_0xbb7d('0x11')]['code']===0x1f4){logger['error'](_0xbb7d('0xc'),_0x1da0bc,_0x28d98d[_0xbb7d('0x11')]['message']);return _0x15d257(_0x28d98d['error'][_0xbb7d('0x12')]);}logger[_0xbb7d('0x11')](_0xbb7d('0xc'),_0x1da0bc,_0x28d98d['error'][_0xbb7d('0x12')]);return _0x12b4b2(_0x28d98d['error'][_0xbb7d('0x12')]);}else{logger[_0xbb7d('0x13')](_0xbb7d('0xc'),_0x1da0bc,_0xbb7d('0xf'));_0x12b4b2(_0x28d98d[_0xbb7d('0x14')][_0xbb7d('0x12')]);}})[_0xbb7d('0x15')](function(_0x1acd19){logger['error']('Template,\x20%s,\x20%s',_0x1da0bc,_0x1acd19);_0x15d257(_0x1acd19);});});}exports['GetTemplate']=function(_0x126c7e){var _0x3f7e3f=this;return new Promise(function(_0x3e114f,_0x275ddd){return db['Template']['findAll']({'raw':_0x126c7e[_0xbb7d('0x16')]?_0x126c7e[_0xbb7d('0x16')][_0xbb7d('0x17')]===undefined?!![]:![]:!![],'where':_0x126c7e['options']?_0x126c7e[_0xbb7d('0x16')]['where']||null:null,'attributes':_0x126c7e[_0xbb7d('0x16')]?_0x126c7e[_0xbb7d('0x16')]['attributes']||null:null,'limit':_0x126c7e['options']?_0x126c7e[_0xbb7d('0x16')]['limit']||null:null,'include':_0x126c7e[_0xbb7d('0x16')]?_0x126c7e['options'][_0xbb7d('0x18')]?_['map'](_0x126c7e[_0xbb7d('0x16')][_0xbb7d('0x18')],function(_0x255b24){return{'model':db[_0x255b24[_0xbb7d('0x19')]],'as':_0x255b24['as'],'attributes':_0x255b24['attributes'],'include':_0x255b24[_0xbb7d('0x18')]?_['map'](_0x255b24['include'],function(_0x2f48d9){return{'model':db[_0x2f48d9[_0xbb7d('0x19')]],'as':_0x2f48d9['as'],'attributes':_0x2f48d9[_0xbb7d('0x1a')],'include':_0x2f48d9['include']?_[_0xbb7d('0x1b')](_0x2f48d9[_0xbb7d('0x18')],function(_0x59878b){return{'model':db[_0x59878b['model']],'as':_0x59878b['as'],'attributes':_0x59878b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb7d('0x1c')](function(_0x2304bd){logger[_0xbb7d('0x13')](_0xbb7d('0x1d'),_0x126c7e);logger['debug']('GetTemplate',_0x126c7e,JSON[_0xbb7d('0x10')](_0x2304bd));_0x3e114f(_0x2304bd);})[_0xbb7d('0x15')](function(_0x86d2c0){logger[_0xbb7d('0x11')](_0xbb7d('0x1d'),_0x86d2c0[_0xbb7d('0x12')],_0x126c7e);_0x275ddd(_0x3f7e3f[_0xbb7d('0x11')](0x1f4,_0x86d2c0[_0xbb7d('0x12')]));});});};
\ No newline at end of file