13f561efd85978b4f41d98c66c8ef061e4716175
[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 _0xfc22=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','moment','bluebird','../../mysqldb'];(function(_0x3b6856,_0x5f2266){var _0x1cbcce=function(_0x568dd4){while(--_0x568dd4){_0x3b6856['push'](_0x3b6856['shift']());}};_0x1cbcce(++_0x5f2266);}(_0xfc22,0x9d));var _0x2fc2=function(_0x542a99,_0x4a20e1){_0x542a99=_0x542a99-0x0;var _0x42bad0=_0xfc22[_0x542a99];return _0x42bad0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2fc2('0x0'));var BPromise=require(_0x2fc2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fc2('0x2'))['db'];var utils=require(_0x2fc2('0x3'));var logger=require(_0x2fc2('0x4'))(_0x2fc2('0x5'));var config=require(_0x2fc2('0x6'));var jayson=require(_0x2fc2('0x7'));var client=jayson[_0x2fc2('0x8')][_0x2fc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xabe6ba,_0x3028c0,_0x5e1bb2){return new BPromise(function(_0x17deb3,_0xfad913){return client[_0x2fc2('0xa')](_0xabe6ba,_0x5e1bb2)['then'](function(_0x634112){logger['info'](_0x2fc2('0xb'),_0x3028c0,_0x2fc2('0xc'));logger[_0x2fc2('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3028c0,'request\x20sent',JSON[_0x2fc2('0xe')](_0x634112));if(_0x634112[_0x2fc2('0xf')]){if(_0x634112['error'][_0x2fc2('0x10')]===0x1f4){logger[_0x2fc2('0xf')](_0x2fc2('0xb'),_0x3028c0,_0x634112['error']['message']);return _0xfad913(_0x634112['error'][_0x2fc2('0x11')]);}logger[_0x2fc2('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3028c0,_0x634112[_0x2fc2('0xf')][_0x2fc2('0x11')]);return _0x17deb3(_0x634112['error']['message']);}else{logger[_0x2fc2('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3028c0,_0x2fc2('0xc'));_0x17deb3(_0x634112['result'][_0x2fc2('0x11')]);}})[_0x2fc2('0x13')](function(_0x14b73d){logger['error'](_0x2fc2('0xb'),_0x3028c0,_0x14b73d);_0xfad913(_0x14b73d);});});}