Built motion from commit 6a09e18b.|2.6.11
[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 _0xeec9=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x224ad8,_0x17dc8d){var _0x5d12d1=function(_0x515965){while(--_0x515965){_0x224ad8['push'](_0x224ad8['shift']());}};_0x5d12d1(++_0x17dc8d);}(_0xeec9,0x1db));var _0x9eec=function(_0x27857b,_0xde3537){_0x27857b=_0x27857b-0x0;var _0x1796db=_0xeec9[_0x27857b];return _0x1796db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9eec('0x0'));var BPromise=require(_0x9eec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eec('0x2'));var db=require(_0x9eec('0x3'))['db'];var utils=require(_0x9eec('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9eec('0x5'));var client=jayson[_0x9eec('0x6')][_0x9eec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43a5bb,_0x131544,_0x271e9f){return new BPromise(function(_0x195d05,_0x2b9bd1){return client[_0x9eec('0x8')](_0x43a5bb,_0x271e9f)[_0x9eec('0x9')](function(_0x17a794){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x131544,_0x9eec('0xa'));logger['debug'](_0x9eec('0xb'),_0x131544,_0x9eec('0xa'),JSON[_0x9eec('0xc')](_0x17a794));if(_0x17a794[_0x9eec('0xd')]){if(_0x17a794['error']['code']===0x1f4){logger[_0x9eec('0xd')](_0x9eec('0xe'),_0x131544,_0x17a794[_0x9eec('0xd')][_0x9eec('0xf')]);return _0x2b9bd1(_0x17a794[_0x9eec('0xd')]['message']);}logger['error'](_0x9eec('0xe'),_0x131544,_0x17a794[_0x9eec('0xd')][_0x9eec('0xf')]);return _0x195d05(_0x17a794[_0x9eec('0xd')][_0x9eec('0xf')]);}else{logger[_0x9eec('0x10')](_0x9eec('0xe'),_0x131544,_0x9eec('0xa'));_0x195d05(_0x17a794[_0x9eec('0x11')][_0x9eec('0xf')]);}})['catch'](function(_0x3283d7){logger[_0x9eec('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x131544,_0x3283d7);_0x2b9bd1(_0x3283d7);});});}