b5062b8c86f7952d0ba950f9655499b1a1686a04
[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 _0xf942=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3a2f2c,_0x361e0d){var _0x5ae7a8=function(_0x34f70d){while(--_0x34f70d){_0x3a2f2c['push'](_0x3a2f2c['shift']());}};_0x5ae7a8(++_0x361e0d);}(_0xf942,0x10b));var _0x2f94=function(_0x42a78a,_0xa1a2ef){_0x42a78a=_0x42a78a-0x0;var _0x1fb3e8=_0xf942[_0x42a78a];return _0x1fb3e8;};'use strict';var _=require('lodash');var util=require(_0x2f94('0x0'));var moment=require(_0x2f94('0x1'));var BPromise=require(_0x2f94('0x2'));var rs=require(_0x2f94('0x3'));var fs=require('fs');var Redis=require(_0x2f94('0x4'));var db=require(_0x2f94('0x5'))['db'];var utils=require(_0x2f94('0x6'));var logger=require(_0x2f94('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f94('0x8'));var client=jayson[_0x2f94('0x9')][_0x2f94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x704f1a,_0x1088f0,_0x9bdeaa){return new BPromise(function(_0x4fe476,_0x3ec1db){return client[_0x2f94('0xb')](_0x704f1a,_0x9bdeaa)[_0x2f94('0xc')](function(_0x1df23b){logger[_0x2f94('0xd')](_0x2f94('0xe'),_0x1088f0,'request\x20sent');logger[_0x2f94('0xf')](_0x2f94('0x10'),_0x1088f0,_0x2f94('0x11'),JSON[_0x2f94('0x12')](_0x1df23b));if(_0x1df23b['error']){if(_0x1df23b[_0x2f94('0x13')][_0x2f94('0x14')]===0x1f4){logger[_0x2f94('0x13')](_0x2f94('0xe'),_0x1088f0,_0x1df23b[_0x2f94('0x13')][_0x2f94('0x15')]);return _0x3ec1db(_0x1df23b[_0x2f94('0x13')][_0x2f94('0x15')]);}logger[_0x2f94('0x13')](_0x2f94('0xe'),_0x1088f0,_0x1df23b['error'][_0x2f94('0x15')]);return _0x4fe476(_0x1df23b[_0x2f94('0x13')][_0x2f94('0x15')]);}else{logger[_0x2f94('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1088f0,_0x2f94('0x11'));_0x4fe476(_0x1df23b[_0x2f94('0x16')][_0x2f94('0x15')]);}})[_0x2f94('0x17')](function(_0x47f3e5){logger[_0x2f94('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1088f0,_0x47f3e5);_0x3ec1db(_0x47f3e5);});});}