18 var _0x076b=['code','message','result','Template','options','raw','where','attributes','limit','model','include','map','then','GetTemplate','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0xd97e59,_0x807a81){var _0x19b441=function(_0x2b6a45){while(--_0x2b6a45){_0xd97e59['push'](_0xd97e59['shift']());}};_0x19b441(++_0x807a81);}(_0x076b,0x1c1));var _0xb076=function(_0x803981,_0x12680a){_0x803981=_0x803981-0x0;var _0x5e40f0=_0x076b[_0x803981];return _0x5e40f0;};'use strict';var _=require(_0xb076('0x0'));var util=require(_0xb076('0x1'));var moment=require(_0xb076('0x2'));var BPromise=require(_0xb076('0x3'));var rs=require(_0xb076('0x4'));var fs=require('fs');var Redis=require(_0xb076('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb076('0x6'))(_0xb076('0x7'));var config=require(_0xb076('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43270b,_0x1821c4,_0x593373){return new BPromise(function(_0x5bda23,_0x26aca5){return client[_0xb076('0x9')](_0x43270b,_0x593373)['then'](function(_0x3dbea1){logger[_0xb076('0xa')](_0xb076('0xb'),_0x1821c4,_0xb076('0xc'));logger[_0xb076('0xd')](_0xb076('0xe'),_0x1821c4,'request\x20sent',JSON['stringify'](_0x3dbea1));if(_0x3dbea1[_0xb076('0xf')]){if(_0x3dbea1[_0xb076('0xf')][_0xb076('0x10')]===0x1f4){logger['error'](_0xb076('0xb'),_0x1821c4,_0x3dbea1[_0xb076('0xf')]['message']);return _0x26aca5(_0x3dbea1['error'][_0xb076('0x11')]);}logger[_0xb076('0xf')](_0xb076('0xb'),_0x1821c4,_0x3dbea1[_0xb076('0xf')]['message']);return _0x5bda23(_0x3dbea1[_0xb076('0xf')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x1821c4,'request\x20sent');_0x5bda23(_0x3dbea1[_0xb076('0x12')][_0xb076('0x11')]);}})['catch'](function(_0x4402c4){logger[_0xb076('0xf')]('Template,\x20%s,\x20%s',_0x1821c4,_0x4402c4);_0x26aca5(_0x4402c4);});});}exports['GetTemplate']=function(_0x2a5c6f){var _0xc32908=this;return new Promise(function(_0x3b5c51,_0x89a125){return db[_0xb076('0x13')]['findAll']({'raw':_0x2a5c6f[_0xb076('0x14')]?_0x2a5c6f[_0xb076('0x14')][_0xb076('0x15')]===undefined?!![]:![]:!![],'where':_0x2a5c6f[_0xb076('0x14')]?_0x2a5c6f[_0xb076('0x14')][_0xb076('0x16')]||null:null,'attributes':_0x2a5c6f[_0xb076('0x14')]?_0x2a5c6f[_0xb076('0x14')][_0xb076('0x17')]||null:null,'limit':_0x2a5c6f['options']?_0x2a5c6f['options'][_0xb076('0x18')]||null:null,'include':_0x2a5c6f[_0xb076('0x14')]?_0x2a5c6f[_0xb076('0x14')]['include']?_['map'](_0x2a5c6f[_0xb076('0x14')]['include'],function(_0x1ef6d6){return{'model':db[_0x1ef6d6[_0xb076('0x19')]],'as':_0x1ef6d6['as'],'attributes':_0x1ef6d6[_0xb076('0x17')],'include':_0x1ef6d6[_0xb076('0x1a')]?_[_0xb076('0x1b')](_0x1ef6d6[_0xb076('0x1a')],function(_0x5bd47d){return{'model':db[_0x5bd47d[_0xb076('0x19')]],'as':_0x5bd47d['as'],'attributes':_0x5bd47d['attributes'],'include':_0x5bd47d[_0xb076('0x1a')]?_[_0xb076('0x1b')](_0x5bd47d[_0xb076('0x1a')],function(_0x13c1a9){return{'model':db[_0x13c1a9[_0xb076('0x19')]],'as':_0x13c1a9['as'],'attributes':_0x13c1a9[_0xb076('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb076('0x1c')](function(_0x153cda){logger['info']('GetTemplate',_0x2a5c6f);logger['debug'](_0xb076('0x1d'),_0x2a5c6f,JSON['stringify'](_0x153cda));_0x3b5c51(_0x153cda);})[_0xb076('0x1e')](function(_0x41f92f){logger[_0xb076('0xf')](_0xb076('0x1d'),_0x41f92f[_0xb076('0x11')],_0x2a5c6f);_0x89a125(_0xc32908['error'](0x1f4,_0x41f92f[_0xb076('0x11')]));});});};