18 var _0x3897=['options','where','attributes','include','model','map','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','raw','update','body','UpdateVoiceQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','findAll'];(function(_0x5b516f,_0x61325c){var _0x106e68=function(_0x967048){while(--_0x967048){_0x5b516f['push'](_0x5b516f['shift']());}};_0x106e68(++_0x61325c);}(_0x3897,0x188));var _0x7389=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x3897[_0x311aad];return _0x1779bd;};'use strict';var _=require(_0x7389('0x0'));var util=require(_0x7389('0x1'));var moment=require('moment');var BPromise=require(_0x7389('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7389('0x3'));var db=require(_0x7389('0x4'))['db'];var utils=require(_0x7389('0x5'));var logger=require(_0x7389('0x6'))(_0x7389('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7389('0x8')][_0x7389('0x9')]({'port':0x232a});config[_0x7389('0xa')]=_[_0x7389('0xb')](config[_0x7389('0xa')],{'host':_0x7389('0xc'),'port':0x18eb});var socket=require(_0x7389('0xd'))(new Redis(config[_0x7389('0xa')]));require('./voiceQueueReport.socket')[_0x7389('0xe')](socket);function respondWithRpcPromise(_0x480e9f,_0x2386e5,_0x55fa2e){return new BPromise(function(_0x16afe0,_0x54f327){return client[_0x7389('0xf')](_0x480e9f,_0x55fa2e)[_0x7389('0x10')](function(_0x5225c2){logger[_0x7389('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x2386e5,_0x7389('0x12'));logger[_0x7389('0x13')](_0x7389('0x14'),_0x2386e5,_0x7389('0x12'),JSON[_0x7389('0x15')](_0x5225c2));if(_0x5225c2[_0x7389('0x16')]){if(_0x5225c2[_0x7389('0x16')][_0x7389('0x17')]===0x1f4){logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x5225c2['error']['message']);return _0x54f327(_0x5225c2[_0x7389('0x16')][_0x7389('0x19')]);}logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x5225c2['error'][_0x7389('0x19')]);return _0x16afe0(_0x5225c2[_0x7389('0x16')][_0x7389('0x19')]);}else{logger[_0x7389('0x11')](_0x7389('0x18'),_0x2386e5,_0x7389('0x12'));_0x16afe0(_0x5225c2['result']['message']);}})[_0x7389('0x1a')](function(_0x3caa09){logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x3caa09);_0x54f327(_0x3caa09);});});}exports['GetVoiceQueueReport']=function(_0x55267d){var _0x569ae6=this;return new Promise(function(_0x4cad21,_0x164694){return db['VoiceQueueReport'][_0x7389('0x1b')]({'raw':_0x55267d[_0x7389('0x1c')]?_0x55267d[_0x7389('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55267d['options']?_0x55267d[_0x7389('0x1c')][_0x7389('0x1d')]||null:null,'attributes':_0x55267d[_0x7389('0x1c')]?_0x55267d['options'][_0x7389('0x1e')]||null:null,'limit':_0x55267d[_0x7389('0x1c')]?_0x55267d['options']['limit']||null:null,'include':_0x55267d['options']?_0x55267d[_0x7389('0x1c')][_0x7389('0x1f')]?_['map'](_0x55267d[_0x7389('0x1c')][_0x7389('0x1f')],function(_0x36de41){return{'model':db[_0x36de41[_0x7389('0x20')]],'as':_0x36de41['as'],'attributes':_0x36de41[_0x7389('0x1e')],'include':_0x36de41[_0x7389('0x1f')]?_[_0x7389('0x21')](_0x36de41[_0x7389('0x1f')],function(_0x486091){return{'model':db[_0x486091[_0x7389('0x20')]],'as':_0x486091['as'],'attributes':_0x486091[_0x7389('0x1e')],'include':_0x486091[_0x7389('0x1f')]?_[_0x7389('0x21')](_0x486091['include'],function(_0x1a55cb){return{'model':db[_0x1a55cb[_0x7389('0x20')]],'as':_0x1a55cb['as'],'attributes':_0x1a55cb[_0x7389('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7389('0x10')](function(_0x597091){logger[_0x7389('0x11')](_0x7389('0x22'),_0x55267d);logger['debug']('GetVoiceQueueReport',_0x55267d,JSON[_0x7389('0x15')](_0x597091));_0x4cad21(_0x597091);})['catch'](function(_0x227d7a){logger[_0x7389('0x16')](_0x7389('0x22'),_0x227d7a[_0x7389('0x19')],_0x55267d);_0x164694(_0x569ae6[_0x7389('0x16')](0x1f4,_0x227d7a['message']));});});};exports[_0x7389('0x23')]=function(_0x2d1385){var _0x171888=this;return new Promise(function(_0x2f851b,_0x4aaafd){return db[_0x7389('0x24')][_0x7389('0x25')](_0x2d1385['body'],{'raw':_0x2d1385['options']?_0x2d1385[_0x7389('0x1c')][_0x7389('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x5f3c14){logger[_0x7389('0x11')]('CreateVoiceQueueReport',_0x2d1385);logger['debug'](_0x7389('0x23'),_0x2d1385,JSON[_0x7389('0x15')](_0x5f3c14));_0x2f851b(_0x5f3c14);})[_0x7389('0x1a')](function(_0x5147d0){logger[_0x7389('0x16')]('CreateVoiceQueueReport',_0x5147d0[_0x7389('0x19')],_0x2d1385);_0x4aaafd(_0x171888[_0x7389('0x16')](0x1f4,_0x5147d0['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x525310){var _0x253e66=this;return new Promise(function(_0x557788,_0x56f639){return db[_0x7389('0x24')][_0x7389('0x27')](_0x525310[_0x7389('0x28')],{'raw':_0x525310['options']?_0x525310['options'][_0x7389('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525310['options']?_0x525310['options'][_0x7389('0x1d')]||null:null,'attributes':_0x525310[_0x7389('0x1c')]?_0x525310['options'][_0x7389('0x1e')]||null:null,'limit':_0x525310['options']?_0x525310[_0x7389('0x1c')]['limit']||null:null})['then'](function(_0x2eed49){logger[_0x7389('0x11')]('UpdateVoiceQueueReport',_0x525310);logger[_0x7389('0x13')]('UpdateVoiceQueueReport',_0x525310,JSON[_0x7389('0x15')](_0x2eed49));_0x557788(_0x2eed49);})[_0x7389('0x1a')](function(_0x4129a2){logger[_0x7389('0x16')](_0x7389('0x29'),_0x4129a2['message'],_0x525310);_0x56f639(_0x253e66[_0x7389('0x16')](0x1f4,_0x4129a2[_0x7389('0x19')]));});});};