73d9b0dcf877276192d7671f483d728b2d6f67f6
[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 _0x1bdb=['moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util'];(function(_0x33485c,_0x92f25){var _0x4a0a6d=function(_0x52fe3b){while(--_0x52fe3b){_0x33485c['push'](_0x33485c['shift']());}};_0x4a0a6d(++_0x92f25);}(_0x1bdb,0x18b));var _0xb1bd=function(_0x3ab53f,_0x508ae7){_0x3ab53f=_0x3ab53f-0x0;var _0x42c654=_0x1bdb[_0x3ab53f];return _0x42c654;};'use strict';var _=require('lodash');var util=require(_0xb1bd('0x0'));var moment=require(_0xb1bd('0x1'));var BPromise=require(_0xb1bd('0x2'));var rs=require(_0xb1bd('0x3'));var fs=require('fs');var Redis=require(_0xb1bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb1bd('0x5'));var client=jayson[_0xb1bd('0x6')][_0xb1bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28a080,_0x204a85,_0x28161d){return new BPromise(function(_0x3f934f,_0xaf7b47){return client[_0xb1bd('0x8')](_0x28a080,_0x28161d)['then'](function(_0x232129){logger['info'](_0xb1bd('0x9'),_0x204a85,_0xb1bd('0xa'));logger['debug'](_0xb1bd('0xb'),_0x204a85,_0xb1bd('0xa'),JSON[_0xb1bd('0xc')](_0x232129));if(_0x232129['error']){if(_0x232129['error']['code']===0x1f4){logger[_0xb1bd('0xd')](_0xb1bd('0x9'),_0x204a85,_0x232129[_0xb1bd('0xd')][_0xb1bd('0xe')]);return _0xaf7b47(_0x232129[_0xb1bd('0xd')][_0xb1bd('0xe')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x204a85,_0x232129[_0xb1bd('0xd')][_0xb1bd('0xe')]);return _0x3f934f(_0x232129[_0xb1bd('0xd')][_0xb1bd('0xe')]);}else{logger[_0xb1bd('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x204a85,'request\x20sent');_0x3f934f(_0x232129[_0xb1bd('0x10')]['message']);}})[_0xb1bd('0x11')](function(_0x207406){logger[_0xb1bd('0xd')](_0xb1bd('0x9'),_0x204a85,_0x207406);_0xaf7b47(_0x207406);});});}