5367afb2367b39ed7eedc4f31dd5024394b57523
[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 _0x82f2=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x85df2b,_0x3bc306){var _0x7848e7=function(_0x5c81b3){while(--_0x5c81b3){_0x85df2b['push'](_0x85df2b['shift']());}};_0x7848e7(++_0x3bc306);}(_0x82f2,0x158));var _0x282f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x82f2[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x282f('0x0'));var util=require(_0x282f('0x1'));var moment=require('moment');var BPromise=require(_0x282f('0x2'));var rs=require(_0x282f('0x3'));var fs=require('fs');var Redis=require(_0x282f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x282f('0x5'));var logger=require('../../config/logger')(_0x282f('0x6'));var config=require(_0x282f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x282f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f0bf,_0x184d5a,_0x2d8f89){return new BPromise(function(_0x33076c,_0x5f1c73){return client['request'](_0x33f0bf,_0x2d8f89)[_0x282f('0x9')](function(_0x544321){logger[_0x282f('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x184d5a,_0x282f('0xb'));logger['debug'](_0x282f('0xc'),_0x184d5a,_0x282f('0xb'),JSON['stringify'](_0x544321));if(_0x544321['error']){if(_0x544321[_0x282f('0xd')][_0x282f('0xe')]===0x1f4){logger[_0x282f('0xd')](_0x282f('0xf'),_0x184d5a,_0x544321[_0x282f('0xd')][_0x282f('0x10')]);return _0x5f1c73(_0x544321['error']['message']);}logger[_0x282f('0xd')](_0x282f('0xf'),_0x184d5a,_0x544321[_0x282f('0xd')]['message']);return _0x33076c(_0x544321[_0x282f('0xd')]['message']);}else{logger[_0x282f('0xa')](_0x282f('0xf'),_0x184d5a,_0x282f('0xb'));_0x33076c(_0x544321[_0x282f('0x11')][_0x282f('0x10')]);}})[_0x282f('0x12')](function(_0x597e2e){logger['error'](_0x282f('0xf'),_0x184d5a,_0x597e2e);_0x5f1c73(_0x597e2e);});});}