07c1a5952e6d3b232866252633a50cbe9e6053f3
[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 _0x36d1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x383415,_0x57fad7){var _0x52b4f7=function(_0x3dd3b5){while(--_0x3dd3b5){_0x383415['push'](_0x383415['shift']());}};_0x52b4f7(++_0x57fad7);}(_0x36d1,0x1a0));var _0x136d=function(_0x307fdd,_0xcdc886){_0x307fdd=_0x307fdd-0x0;var _0x24ae6c=_0x36d1[_0x307fdd];return _0x24ae6c;};'use strict';var _=require(_0x136d('0x0'));var util=require('util');var moment=require(_0x136d('0x1'));var BPromise=require(_0x136d('0x2'));var rs=require(_0x136d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x136d('0x4'));var logger=require(_0x136d('0x5'))(_0x136d('0x6'));var config=require(_0x136d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x136d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53329d,_0x58f493,_0x2c490e){return new BPromise(function(_0x17ad17,_0xcccc42){return client[_0x136d('0x9')](_0x53329d,_0x2c490e)['then'](function(_0x1c2cf4){logger[_0x136d('0xa')](_0x136d('0xb'),_0x58f493,'request\x20sent');logger[_0x136d('0xc')](_0x136d('0xd'),_0x58f493,_0x136d('0xe'),JSON[_0x136d('0xf')](_0x1c2cf4));if(_0x1c2cf4[_0x136d('0x10')]){if(_0x1c2cf4['error'][_0x136d('0x11')]===0x1f4){logger[_0x136d('0x10')](_0x136d('0xb'),_0x58f493,_0x1c2cf4[_0x136d('0x10')][_0x136d('0x12')]);return _0xcccc42(_0x1c2cf4[_0x136d('0x10')][_0x136d('0x12')]);}logger[_0x136d('0x10')](_0x136d('0xb'),_0x58f493,_0x1c2cf4[_0x136d('0x10')][_0x136d('0x12')]);return _0x17ad17(_0x1c2cf4[_0x136d('0x10')][_0x136d('0x12')]);}else{logger[_0x136d('0xa')](_0x136d('0xb'),_0x58f493,_0x136d('0xe'));_0x17ad17(_0x1c2cf4[_0x136d('0x13')][_0x136d('0x12')]);}})[_0x136d('0x14')](function(_0x4c1b07){logger[_0x136d('0x10')](_0x136d('0xb'),_0x58f493,_0x4c1b07);_0xcccc42(_0x4c1b07);});});}