fa703fb9350dcff0594e914e6616c70b8b3f43f4
[motion2.git] / server / api / analyticCustomReport / analyticCustomReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x678c=['code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x505e7a,_0xe16c5e){var _0x53d4c6=function(_0x425a0d){while(--_0x425a0d){_0x505e7a['push'](_0x505e7a['shift']());}};_0x53d4c6(++_0xe16c5e);}(_0x678c,0x71));var _0xc678=function(_0x3c1129,_0x36e8c8){_0x3c1129=_0x3c1129-0x0;var _0x1709c4=_0x678c[_0x3c1129];return _0x1709c4;};'use strict';var _=require(_0xc678('0x0'));var util=require('util');var moment=require(_0xc678('0x1'));var BPromise=require(_0xc678('0x2'));var rs=require(_0xc678('0x3'));var fs=require('fs');var Redis=require(_0xc678('0x4'));var db=require(_0xc678('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc678('0x6'));var config=require(_0xc678('0x7'));var jayson=require(_0xc678('0x8'));var client=jayson[_0xc678('0x9')][_0xc678('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eff16,_0x4a5691,_0x1c50e6){return new BPromise(function(_0x240127,_0x25088d){return client[_0xc678('0xb')](_0x5eff16,_0x1c50e6)[_0xc678('0xc')](function(_0x4e50bf){logger[_0xc678('0xd')](_0xc678('0xe'),_0x4a5691,_0xc678('0xf'));logger['debug'](_0xc678('0x10'),_0x4a5691,'request\x20sent',JSON[_0xc678('0x11')](_0x4e50bf));if(_0x4e50bf[_0xc678('0x12')]){if(_0x4e50bf[_0xc678('0x12')][_0xc678('0x13')]===0x1f4){logger[_0xc678('0x12')](_0xc678('0xe'),_0x4a5691,_0x4e50bf[_0xc678('0x12')]['message']);return _0x25088d(_0x4e50bf['error']['message']);}logger[_0xc678('0x12')](_0xc678('0xe'),_0x4a5691,_0x4e50bf[_0xc678('0x12')][_0xc678('0x14')]);return _0x240127(_0x4e50bf[_0xc678('0x12')][_0xc678('0x14')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4a5691,_0xc678('0xf'));_0x240127(_0x4e50bf[_0xc678('0x15')][_0xc678('0x14')]);}})['catch'](function(_0x1d96c4){logger['error'](_0xc678('0xe'),_0x4a5691,_0x1d96c4);_0x25088d(_0x1d96c4);});});}