333a96372bcf5ba89e4cb27b1492f5c73694194e
[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 _0xd4a2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xd4a2,0x129));var _0x2d4a=function(_0x510801,_0x5dc617){_0x510801=_0x510801-0x0;var _0x439021=_0xd4a2[_0x510801];return _0x439021;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d4a('0x0'));var BPromise=require(_0x2d4a('0x1'));var rs=require(_0x2d4a('0x2'));var fs=require('fs');var Redis=require(_0x2d4a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x4'));var logger=require(_0x2d4a('0x5'))(_0x2d4a('0x6'));var config=require(_0x2d4a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dd019,_0x448ee3,_0x16032d){return new BPromise(function(_0x16f5d0,_0x51be72){return client[_0x2d4a('0x9')](_0x4dd019,_0x16032d)[_0x2d4a('0xa')](function(_0x5ca93a){logger[_0x2d4a('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x448ee3,_0x2d4a('0xc'));logger[_0x2d4a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x448ee3,_0x2d4a('0xc'),JSON[_0x2d4a('0xe')](_0x5ca93a));if(_0x5ca93a['error']){if(_0x5ca93a[_0x2d4a('0xf')]['code']===0x1f4){logger[_0x2d4a('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x448ee3,_0x5ca93a[_0x2d4a('0xf')][_0x2d4a('0x10')]);return _0x51be72(_0x5ca93a[_0x2d4a('0xf')][_0x2d4a('0x10')]);}logger[_0x2d4a('0xf')](_0x2d4a('0x11'),_0x448ee3,_0x5ca93a[_0x2d4a('0xf')][_0x2d4a('0x10')]);return _0x16f5d0(_0x5ca93a['error'][_0x2d4a('0x10')]);}else{logger['info'](_0x2d4a('0x11'),_0x448ee3,_0x2d4a('0xc'));_0x16f5d0(_0x5ca93a[_0x2d4a('0x12')][_0x2d4a('0x10')]);}})[_0x2d4a('0x13')](function(_0xabd175){logger[_0x2d4a('0xf')](_0x2d4a('0x11'),_0x448ee3,_0xabd175);_0x51be72(_0xabd175);});});}