563053406e05b2425d1fece6bf95dec3482fa8f4
[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 _0x3f8b=['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','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33a389,_0x59f55e){var _0x7785db=function(_0xc807f2){while(--_0xc807f2){_0x33a389['push'](_0x33a389['shift']());}};_0x7785db(++_0x59f55e);}(_0x3f8b,0x179));var _0xb3f8=function(_0x37851e,_0x13765c){_0x37851e=_0x37851e-0x0;var _0x5af6be=_0x3f8b[_0x37851e];return _0x5af6be;};'use strict';var _=require('lodash');var util=require(_0xb3f8('0x0'));var moment=require(_0xb3f8('0x1'));var BPromise=require('bluebird');var rs=require(_0xb3f8('0x2'));var fs=require('fs');var Redis=require(_0xb3f8('0x3'));var db=require(_0xb3f8('0x4'))['db'];var utils=require(_0xb3f8('0x5'));var logger=require(_0xb3f8('0x6'))(_0xb3f8('0x7'));var config=require(_0xb3f8('0x8'));var jayson=require(_0xb3f8('0x9'));var client=jayson[_0xb3f8('0xa')][_0xb3f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2534d2,_0x37902a,_0x465f56){return new BPromise(function(_0x5e6029,_0x3ae2f2){return client[_0xb3f8('0xc')](_0x2534d2,_0x465f56)[_0xb3f8('0xd')](function(_0x441f32){logger[_0xb3f8('0xe')](_0xb3f8('0xf'),_0x37902a,_0xb3f8('0x10'));logger['debug'](_0xb3f8('0x11'),_0x37902a,_0xb3f8('0x10'),JSON[_0xb3f8('0x12')](_0x441f32));if(_0x441f32[_0xb3f8('0x13')]){if(_0x441f32['error'][_0xb3f8('0x14')]===0x1f4){logger[_0xb3f8('0x13')](_0xb3f8('0xf'),_0x37902a,_0x441f32[_0xb3f8('0x13')][_0xb3f8('0x15')]);return _0x3ae2f2(_0x441f32[_0xb3f8('0x13')][_0xb3f8('0x15')]);}logger['error'](_0xb3f8('0xf'),_0x37902a,_0x441f32[_0xb3f8('0x13')]['message']);return _0x5e6029(_0x441f32[_0xb3f8('0x13')][_0xb3f8('0x15')]);}else{logger[_0xb3f8('0xe')](_0xb3f8('0xf'),_0x37902a,_0xb3f8('0x10'));_0x5e6029(_0x441f32[_0xb3f8('0x16')][_0xb3f8('0x15')]);}})[_0xb3f8('0x17')](function(_0x498187){logger['error'](_0xb3f8('0xf'),_0x37902a,_0x498187);_0x3ae2f2(_0x498187);});});}