Built motion from commit (unavailable).|2.5.8
[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 _0x6c99=['jayson/promise','http','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','lodash','moment','../../config/logger','rpc','../../config/environment'];(function(_0x48139c,_0x393763){var _0x5b6efc=function(_0x499cf5){while(--_0x499cf5){_0x48139c['push'](_0x48139c['shift']());}};_0x5b6efc(++_0x393763);}(_0x6c99,0x9b));var _0x96c9=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x6c99[_0x10e983];return _0x324138;};'use strict';var _=require(_0x96c9('0x0'));var util=require('util');var moment=require(_0x96c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96c9('0x2'))(_0x96c9('0x3'));var config=require(_0x96c9('0x4'));var jayson=require(_0x96c9('0x5'));var client=jayson['client'][_0x96c9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1a30b2,_0x4323be,_0x31d79e){return new BPromise(function(_0x1a1dd0,_0x5a3e2f){return client['request'](_0x1a30b2,_0x31d79e)[_0x96c9('0x7')](function(_0x55bf5c){logger[_0x96c9('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4323be,_0x96c9('0x9'));logger[_0x96c9('0xa')](_0x96c9('0xb'),_0x4323be,_0x96c9('0x9'),JSON['stringify'](_0x55bf5c));if(_0x55bf5c[_0x96c9('0xc')]){if(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xd')]===0x1f4){logger[_0x96c9('0xc')](_0x96c9('0xe'),_0x4323be,_0x55bf5c['error'][_0x96c9('0xf')]);return _0x5a3e2f(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xf')]);}logger[_0x96c9('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4323be,_0x55bf5c['error'][_0x96c9('0xf')]);return _0x1a1dd0(_0x55bf5c[_0x96c9('0xc')][_0x96c9('0xf')]);}else{logger[_0x96c9('0x8')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4323be,'request\x20sent');_0x1a1dd0(_0x55bf5c['result'][_0x96c9('0xf')]);}})['catch'](function(_0x348f74){logger['error'](_0x96c9('0xe'),_0x4323be,_0x348f74);_0x5a3e2f(_0x348f74);});});}