Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / analyticDefaultReport / analyticDefaultReport.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 _0x9f79=['AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x46a9a4,_0x537b75){var _0x49765c=function(_0x3c0a6e){while(--_0x3c0a6e){_0x46a9a4['push'](_0x46a9a4['shift']());}};_0x49765c(++_0x537b75);}(_0x9f79,0x169));var _0x99f7=function(_0x1f53f0,_0x11ef35){_0x1f53f0=_0x1f53f0-0x0;var _0xe4da66=_0x9f79[_0x1f53f0];return _0xe4da66;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x99f7('0x0'));var rs=require(_0x99f7('0x1'));var fs=require('fs');var Redis=require(_0x99f7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x99f7('0x3'));var logger=require(_0x99f7('0x4'))(_0x99f7('0x5'));var config=require(_0x99f7('0x6'));var jayson=require(_0x99f7('0x7'));var client=jayson[_0x99f7('0x8')][_0x99f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36fa11,_0x2f0bd0,_0x130673){return new BPromise(function(_0x347b64,_0x56f36d){return client[_0x99f7('0xa')](_0x36fa11,_0x130673)[_0x99f7('0xb')](function(_0x4404ad){logger[_0x99f7('0xc')](_0x99f7('0xd'),_0x2f0bd0,'request\x20sent');logger[_0x99f7('0xe')](_0x99f7('0xf'),_0x2f0bd0,_0x99f7('0x10'),JSON[_0x99f7('0x11')](_0x4404ad));if(_0x4404ad[_0x99f7('0x12')]){if(_0x4404ad[_0x99f7('0x12')]['code']===0x1f4){logger[_0x99f7('0x12')](_0x99f7('0xd'),_0x2f0bd0,_0x4404ad[_0x99f7('0x12')][_0x99f7('0x13')]);return _0x56f36d(_0x4404ad[_0x99f7('0x12')][_0x99f7('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2f0bd0,_0x4404ad[_0x99f7('0x12')][_0x99f7('0x13')]);return _0x347b64(_0x4404ad[_0x99f7('0x12')][_0x99f7('0x13')]);}else{logger[_0x99f7('0xc')](_0x99f7('0xd'),_0x2f0bd0,_0x99f7('0x10'));_0x347b64(_0x4404ad[_0x99f7('0x14')][_0x99f7('0x13')]);}})[_0x99f7('0x15')](function(_0x33e53d){logger[_0x99f7('0x12')](_0x99f7('0xd'),_0x2f0bd0,_0x33e53d);_0x56f36d(_0x33e53d);});});}