6790c980ae1d09330ca5e77100cd85582cbc3e35
[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 _0xa521=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x4a8d56,_0x2c7781){var _0x35a536=function(_0x4fa9fc){while(--_0x4fa9fc){_0x4a8d56['push'](_0x4a8d56['shift']());}};_0x35a536(++_0x2c7781);}(_0xa521,0x130));var _0x1a52=function(_0x507662,_0x3b907d){_0x507662=_0x507662-0x0;var _0x4e266a=_0xa521[_0x507662];return _0x4e266a;};'use strict';var _=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var moment=require('moment');var BPromise=require(_0x1a52('0x2'));var rs=require(_0x1a52('0x3'));var fs=require('fs');var Redis=require(_0x1a52('0x4'));var db=require(_0x1a52('0x5'))['db'];var utils=require(_0x1a52('0x6'));var logger=require('../../config/logger')(_0x1a52('0x7'));var config=require(_0x1a52('0x8'));var jayson=require(_0x1a52('0x9'));var client=jayson[_0x1a52('0xa')][_0x1a52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb2b4,_0x5e50d1,_0x34abc9){return new BPromise(function(_0x1e0e25,_0x3ee25e){return client[_0x1a52('0xc')](_0x1eb2b4,_0x34abc9)[_0x1a52('0xd')](function(_0x1bdafa){logger[_0x1a52('0xe')](_0x1a52('0xf'),_0x5e50d1,_0x1a52('0x10'));logger[_0x1a52('0x11')](_0x1a52('0x12'),_0x5e50d1,'request\x20sent',JSON['stringify'](_0x1bdafa));if(_0x1bdafa[_0x1a52('0x13')]){if(_0x1bdafa[_0x1a52('0x13')]['code']===0x1f4){logger[_0x1a52('0x13')](_0x1a52('0xf'),_0x5e50d1,_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);return _0x3ee25e(_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);}logger[_0x1a52('0x13')](_0x1a52('0xf'),_0x5e50d1,_0x1bdafa[_0x1a52('0x13')]['message']);return _0x1e0e25(_0x1bdafa[_0x1a52('0x13')][_0x1a52('0x14')]);}else{logger[_0x1a52('0xe')](_0x1a52('0xf'),_0x5e50d1,_0x1a52('0x10'));_0x1e0e25(_0x1bdafa[_0x1a52('0x15')]['message']);}})['catch'](function(_0x1f0b00){logger[_0x1a52('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e50d1,_0x1f0b00);_0x3ee25e(_0x1f0b00);});});}