5dea886d7218b87af351c12e9485440a49b26843
[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 _0xd85a=['client','http','then','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4ef1b6,_0x502ac2){var _0x164c1f=function(_0x3c6ee2){while(--_0x3c6ee2){_0x4ef1b6['push'](_0x4ef1b6['shift']());}};_0x164c1f(++_0x502ac2);}(_0xd85a,0x115));var _0xad85=function(_0x4ec80e,_0x374028){_0x4ec80e=_0x4ec80e-0x0;var _0x2a19b8=_0xd85a[_0x4ec80e];return _0x2a19b8;};'use strict';var _=require(_0xad85('0x0'));var util=require(_0xad85('0x1'));var moment=require(_0xad85('0x2'));var BPromise=require('bluebird');var rs=require(_0xad85('0x3'));var fs=require('fs');var Redis=require(_0xad85('0x4'));var db=require(_0xad85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad85('0x6'))('rpc');var config=require(_0xad85('0x7'));var jayson=require(_0xad85('0x8'));var client=jayson[_0xad85('0x9')][_0xad85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20f3b7,_0x2f28c6,_0x4d8b6b){return new BPromise(function(_0x4edae7,_0x54a005){return client['request'](_0x20f3b7,_0x4d8b6b)[_0xad85('0xb')](function(_0x5c23ee){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2f28c6,_0xad85('0xc'));logger[_0xad85('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2f28c6,_0xad85('0xc'),JSON[_0xad85('0xe')](_0x5c23ee));if(_0x5c23ee[_0xad85('0xf')]){if(_0x5c23ee[_0xad85('0xf')][_0xad85('0x10')]===0x1f4){logger['error'](_0xad85('0x11'),_0x2f28c6,_0x5c23ee[_0xad85('0xf')][_0xad85('0x12')]);return _0x54a005(_0x5c23ee['error'][_0xad85('0x12')]);}logger[_0xad85('0xf')](_0xad85('0x11'),_0x2f28c6,_0x5c23ee[_0xad85('0xf')][_0xad85('0x12')]);return _0x4edae7(_0x5c23ee[_0xad85('0xf')]['message']);}else{logger[_0xad85('0x13')](_0xad85('0x11'),_0x2f28c6,'request\x20sent');_0x4edae7(_0x5c23ee[_0xad85('0x14')]['message']);}})[_0xad85('0x15')](function(_0x1ae719){logger[_0xad85('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2f28c6,_0x1ae719);_0x54a005(_0x1ae719);});});}