e68cc9999300a6899a53c4f282df82d59d7c7786
[motion2.git] / server / api / analyticDefaultReport / analyticDefaultReport.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 _0x315f=['error','message','result','catch','lodash','moment','ioredis','../../config/environment','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x315f,0x174));var _0xf315=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x315f[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');var moment=require(_0xf315('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf315('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf315('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xf315('0x4')][_0xf315('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xc2344,_0x1e42f7,_0xbfd128){return new BPromise(function(_0x430ba1,_0x48679b){return client['request'](_0xc2344,_0xbfd128)[_0xf315('0x6')](function(_0x529dae){logger[_0xf315('0x7')](_0xf315('0x8'),_0x1e42f7,_0xf315('0x9'));logger[_0xf315('0xa')](_0xf315('0xb'),_0x1e42f7,'request\x20sent',JSON['stringify'](_0x529dae));if(_0x529dae[_0xf315('0xc')]){if(_0x529dae['error']['code']===0x1f4){logger[_0xf315('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1e42f7,_0x529dae[_0xf315('0xc')][_0xf315('0xd')]);return _0x48679b(_0x529dae[_0xf315('0xc')][_0xf315('0xd')]);}logger['error'](_0xf315('0x8'),_0x1e42f7,_0x529dae[_0xf315('0xc')]['message']);return _0x430ba1(_0x529dae[_0xf315('0xc')]['message']);}else{logger[_0xf315('0x7')](_0xf315('0x8'),_0x1e42f7,_0xf315('0x9'));_0x430ba1(_0x529dae[_0xf315('0xe')][_0xf315('0xd')]);}})[_0xf315('0xf')](function(_0xc4dde8){logger[_0xf315('0xc')](_0xf315('0x8'),_0x1e42f7,_0xc4dde8);_0x48679b(_0xc4dde8);});});}