Built motion from commit (unavailable).|2.5.30
[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 _0x7d48=['http','request','debug','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x441363,_0x2edbd3){var _0x1eeb80=function(_0x227840){while(--_0x227840){_0x441363['push'](_0x441363['shift']());}};_0x1eeb80(++_0x2edbd3);}(_0x7d48,0x14d));var _0x87d4=function(_0x72e50b,_0x5dd3b7){_0x72e50b=_0x72e50b-0x0;var _0xbcc81=_0x7d48[_0x72e50b];return _0xbcc81;};'use strict';var _=require('lodash');var util=require(_0x87d4('0x0'));var moment=require(_0x87d4('0x1'));var BPromise=require(_0x87d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87d4('0x3'))['db'];var utils=require(_0x87d4('0x4'));var logger=require(_0x87d4('0x5'))(_0x87d4('0x6'));var config=require(_0x87d4('0x7'));var jayson=require(_0x87d4('0x8'));var client=jayson['client'][_0x87d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23656f,_0x55bf2f,_0x1d637b){return new BPromise(function(_0x22c4f9,_0x541ee4){return client[_0x87d4('0xa')](_0x23656f,_0x1d637b)['then'](function(_0x553c08){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x55bf2f,'request\x20sent');logger[_0x87d4('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x55bf2f,_0x87d4('0xc'),JSON[_0x87d4('0xd')](_0x553c08));if(_0x553c08[_0x87d4('0xe')]){if(_0x553c08['error'][_0x87d4('0xf')]===0x1f4){logger['error'](_0x87d4('0x10'),_0x55bf2f,_0x553c08[_0x87d4('0xe')]['message']);return _0x541ee4(_0x553c08[_0x87d4('0xe')][_0x87d4('0x11')]);}logger[_0x87d4('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x55bf2f,_0x553c08['error']['message']);return _0x22c4f9(_0x553c08[_0x87d4('0xe')]['message']);}else{logger[_0x87d4('0x12')](_0x87d4('0x10'),_0x55bf2f,_0x87d4('0xc'));_0x22c4f9(_0x553c08['result']['message']);}})['catch'](function(_0x2dbc30){logger[_0x87d4('0xe')](_0x87d4('0x10'),_0x55bf2f,_0x2dbc30);_0x541ee4(_0x2dbc30);});});}