493c6bc137da83a5b4bd9ee2f9b3a79b3c164744
[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 _0x54e6=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4ff876,_0x293d17){var _0x118ef3=function(_0x327708){while(--_0x327708){_0x4ff876['push'](_0x4ff876['shift']());}};_0x118ef3(++_0x293d17);}(_0x54e6,0x1b3));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x654e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x654e('0x1'));var rs=require(_0x654e('0x2'));var fs=require('fs');var Redis=require(_0x654e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x654e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x654e('0x5'));var jayson=require(_0x654e('0x6'));var client=jayson['client'][_0x654e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ba3,_0xc42c4f,_0x238d99){return new BPromise(function(_0x3f4904,_0x401e3d){return client['request'](_0x2d0ba3,_0x238d99)['then'](function(_0x9db266){logger[_0x654e('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc42c4f,_0x654e('0x9'));logger['debug'](_0x654e('0xa'),_0xc42c4f,_0x654e('0x9'),JSON['stringify'](_0x9db266));if(_0x9db266[_0x654e('0xb')]){if(_0x9db266['error']['code']===0x1f4){logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x9db266['error'][_0x654e('0xd')]);return _0x401e3d(_0x9db266[_0x654e('0xb')]['message']);}logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x9db266[_0x654e('0xb')][_0x654e('0xd')]);return _0x3f4904(_0x9db266[_0x654e('0xb')][_0x654e('0xd')]);}else{logger[_0x654e('0x8')](_0x654e('0xc'),_0xc42c4f,_0x654e('0x9'));_0x3f4904(_0x9db266[_0x654e('0xe')][_0x654e('0xd')]);}})[_0x654e('0xf')](function(_0x53efc7){logger[_0x654e('0xb')](_0x654e('0xc'),_0xc42c4f,_0x53efc7);_0x401e3d(_0x53efc7);});});}