Built motion from commit c0cdc9d8.|2.6.28
[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 _0xaec4=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xbef04,_0x2973e){var _0x4ca48f=function(_0x17d428){while(--_0x17d428){_0xbef04['push'](_0xbef04['shift']());}};_0x4ca48f(++_0x2973e);}(_0xaec4,0xbb));var _0x4aec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaec4[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x4aec('0x0'));var moment=require('moment');var BPromise=require(_0x4aec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aec('0x2'));var db=require(_0x4aec('0x3'))['db'];var utils=require(_0x4aec('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4aec('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4aec('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4f3938,_0x350d03,_0x416a7d){return new BPromise(function(_0xf8a192,_0xe65772){return client['request'](_0x4f3938,_0x416a7d)['then'](function(_0x136c1e){logger[_0x4aec('0x7')](_0x4aec('0x8'),_0x350d03,_0x4aec('0x9'));logger[_0x4aec('0xa')](_0x4aec('0xb'),_0x350d03,_0x4aec('0x9'),JSON[_0x4aec('0xc')](_0x136c1e));if(_0x136c1e[_0x4aec('0xd')]){if(_0x136c1e[_0x4aec('0xd')][_0x4aec('0xe')]===0x1f4){logger[_0x4aec('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x350d03,_0x136c1e['error'][_0x4aec('0xf')]);return _0xe65772(_0x136c1e[_0x4aec('0xd')][_0x4aec('0xf')]);}logger[_0x4aec('0xd')](_0x4aec('0x8'),_0x350d03,_0x136c1e[_0x4aec('0xd')][_0x4aec('0xf')]);return _0xf8a192(_0x136c1e[_0x4aec('0xd')]['message']);}else{logger[_0x4aec('0x7')]('AnalyticCustomReport,\x20%s,\x20%s',_0x350d03,_0x4aec('0x9'));_0xf8a192(_0x136c1e[_0x4aec('0x10')]['message']);}})['catch'](function(_0x50bc75){logger[_0x4aec('0xd')](_0x4aec('0x8'),_0x350d03,_0x50bc75);_0xe65772(_0x50bc75);});});}