Built motion from commit 64440dd5.|2.6.29
[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 _0x5e9a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring'];(function(_0x284311,_0x1e89f5){var _0x1f2969=function(_0x222c7e){while(--_0x222c7e){_0x284311['push'](_0x284311['shift']());}};_0x1f2969(++_0x1e89f5);}(_0x5e9a,0x155));var _0xa5e9=function(_0x1de88d,_0x2fc37e){_0x1de88d=_0x1de88d-0x0;var _0x41bfea=_0x5e9a[_0x1de88d];return _0x41bfea;};'use strict';var _=require('lodash');var util=require(_0xa5e9('0x0'));var moment=require(_0xa5e9('0x1'));var BPromise=require(_0xa5e9('0x2'));var rs=require(_0xa5e9('0x3'));var fs=require('fs');var Redis=require(_0xa5e9('0x4'));var db=require(_0xa5e9('0x5'))['db'];var utils=require(_0xa5e9('0x6'));var logger=require(_0xa5e9('0x7'))(_0xa5e9('0x8'));var config=require(_0xa5e9('0x9'));var jayson=require(_0xa5e9('0xa'));var client=jayson[_0xa5e9('0xb')][_0xa5e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x473dee,_0x8deaac,_0xaac9d8){return new BPromise(function(_0x25c9fc,_0x46a081){return client[_0xa5e9('0xd')](_0x473dee,_0xaac9d8)[_0xa5e9('0xe')](function(_0x2c9f30){logger[_0xa5e9('0xf')](_0xa5e9('0x10'),_0x8deaac,_0xa5e9('0x11'));logger[_0xa5e9('0x12')](_0xa5e9('0x13'),_0x8deaac,_0xa5e9('0x11'),JSON['stringify'](_0x2c9f30));if(_0x2c9f30[_0xa5e9('0x14')]){if(_0x2c9f30['error']['code']===0x1f4){logger[_0xa5e9('0x14')](_0xa5e9('0x10'),_0x8deaac,_0x2c9f30[_0xa5e9('0x14')][_0xa5e9('0x15')]);return _0x46a081(_0x2c9f30[_0xa5e9('0x14')][_0xa5e9('0x15')]);}logger[_0xa5e9('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8deaac,_0x2c9f30['error']['message']);return _0x25c9fc(_0x2c9f30['error'][_0xa5e9('0x15')]);}else{logger[_0xa5e9('0xf')](_0xa5e9('0x10'),_0x8deaac,'request\x20sent');_0x25c9fc(_0x2c9f30[_0xa5e9('0x16')][_0xa5e9('0x15')]);}})['catch'](function(_0x5cc3cd){logger[_0xa5e9('0x14')](_0xa5e9('0x10'),_0x8deaac,_0x5cc3cd);_0x46a081(_0x5cc3cd);});});}