5b756f8dd189039098941ebcdabe078ef22f2f4e
[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 _0xcf7a=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x35b201,_0x4a6e0c){var _0x998cc0=function(_0x2f0565){while(--_0x2f0565){_0x35b201['push'](_0x35b201['shift']());}};_0x998cc0(++_0x4a6e0c);}(_0xcf7a,0x1a7));var _0xacf7=function(_0x169c25,_0xb9b181){_0x169c25=_0x169c25-0x0;var _0x3688b4=_0xcf7a[_0x169c25];return _0x3688b4;};'use strict';var _=require(_0xacf7('0x0'));var util=require(_0xacf7('0x1'));var moment=require(_0xacf7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacf7('0x3'));var db=require(_0xacf7('0x4'))['db'];var utils=require(_0xacf7('0x5'));var logger=require(_0xacf7('0x6'))(_0xacf7('0x7'));var config=require(_0xacf7('0x8'));var jayson=require(_0xacf7('0x9'));var client=jayson[_0xacf7('0xa')][_0xacf7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d1f9,_0x616916,_0x3cc8e9){return new BPromise(function(_0x5cf8a9,_0x4547a1){return client[_0xacf7('0xc')](_0x17d1f9,_0x3cc8e9)[_0xacf7('0xd')](function(_0x1266e0){logger['info'](_0xacf7('0xe'),_0x616916,_0xacf7('0xf'));logger[_0xacf7('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x616916,_0xacf7('0xf'),JSON[_0xacf7('0x11')](_0x1266e0));if(_0x1266e0['error']){if(_0x1266e0[_0xacf7('0x12')][_0xacf7('0x13')]===0x1f4){logger[_0xacf7('0x12')](_0xacf7('0xe'),_0x616916,_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);return _0x4547a1(_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);}logger['error'](_0xacf7('0xe'),_0x616916,_0x1266e0[_0xacf7('0x12')][_0xacf7('0x14')]);return _0x5cf8a9(_0x1266e0[_0xacf7('0x12')]['message']);}else{logger[_0xacf7('0x15')](_0xacf7('0xe'),_0x616916,'request\x20sent');_0x5cf8a9(_0x1266e0[_0xacf7('0x16')]['message']);}})['catch'](function(_0x230022){logger[_0xacf7('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x616916,_0x230022);_0x4547a1(_0x230022);});});}