d6dacc0c579e47aa9e0746d93e44d9d8b0b17f4e
[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 _0x80a9=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80a9,0xc3));var _0x980a=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x80a9[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0x980a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x980a('0x1'));var fs=require('fs');var Redis=require(_0x980a('0x2'));var db=require(_0x980a('0x3'))['db'];var utils=require(_0x980a('0x4'));var logger=require(_0x980a('0x5'))('rpc');var config=require(_0x980a('0x6'));var jayson=require(_0x980a('0x7'));var client=jayson[_0x980a('0x8')][_0x980a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e22,_0x253536,_0x2c4f8f){return new BPromise(function(_0xca82dc,_0x3b7811){return client[_0x980a('0xa')](_0x4d2e22,_0x2c4f8f)['then'](function(_0x497977){logger[_0x980a('0xb')](_0x980a('0xc'),_0x253536,_0x980a('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x253536,_0x980a('0xd'),JSON[_0x980a('0xe')](_0x497977));if(_0x497977[_0x980a('0xf')]){if(_0x497977[_0x980a('0xf')][_0x980a('0x10')]===0x1f4){logger[_0x980a('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x253536,_0x497977['error'][_0x980a('0x11')]);return _0x3b7811(_0x497977[_0x980a('0xf')][_0x980a('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x253536,_0x497977[_0x980a('0xf')][_0x980a('0x11')]);return _0xca82dc(_0x497977[_0x980a('0xf')][_0x980a('0x11')]);}else{logger[_0x980a('0xb')](_0x980a('0xc'),_0x253536,_0x980a('0xd'));_0xca82dc(_0x497977[_0x980a('0x12')]['message']);}})[_0x980a('0x13')](function(_0x3dd9f1){logger[_0x980a('0xf')](_0x980a('0xc'),_0x253536,_0x3dd9f1);_0x3b7811(_0x3dd9f1);});});}