61209c5e819fbca423247c074ff28e14d76e382c
[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 _0x23f6=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0xd6d24d,_0x4491a8){var _0xff8567=function(_0x18f87f){while(--_0x18f87f){_0xd6d24d['push'](_0xd6d24d['shift']());}};_0xff8567(++_0x4491a8);}(_0x23f6,0x16e));var _0x623f=function(_0x4b8254,_0x162ea2){_0x4b8254=_0x4b8254-0x0;var _0x53a590=_0x23f6[_0x4b8254];return _0x53a590;};'use strict';var _=require(_0x623f('0x0'));var util=require(_0x623f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x623f('0x2'));var fs=require('fs');var Redis=require(_0x623f('0x3'));var db=require(_0x623f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x623f('0x5'))(_0x623f('0x6'));var config=require(_0x623f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x623f('0x8')][_0x623f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dd3cc,_0x5b1fdd,_0x20b3f8){return new BPromise(function(_0x317b5f,_0x1bf9bb){return client['request'](_0x5dd3cc,_0x20b3f8)[_0x623f('0xa')](function(_0x27cf7d){logger[_0x623f('0xb')](_0x623f('0xc'),_0x5b1fdd,_0x623f('0xd'));logger[_0x623f('0xe')](_0x623f('0xf'),_0x5b1fdd,'request\x20sent',JSON[_0x623f('0x10')](_0x27cf7d));if(_0x27cf7d[_0x623f('0x11')]){if(_0x27cf7d[_0x623f('0x11')]['code']===0x1f4){logger[_0x623f('0x11')](_0x623f('0xc'),_0x5b1fdd,_0x27cf7d[_0x623f('0x11')]['message']);return _0x1bf9bb(_0x27cf7d[_0x623f('0x11')][_0x623f('0x12')]);}logger[_0x623f('0x11')](_0x623f('0xc'),_0x5b1fdd,_0x27cf7d[_0x623f('0x11')][_0x623f('0x12')]);return _0x317b5f(_0x27cf7d[_0x623f('0x11')][_0x623f('0x12')]);}else{logger[_0x623f('0xb')](_0x623f('0xc'),_0x5b1fdd,'request\x20sent');_0x317b5f(_0x27cf7d[_0x623f('0x13')]['message']);}})[_0x623f('0x14')](function(_0x1a373a){logger[_0x623f('0x11')](_0x623f('0xc'),_0x5b1fdd,_0x1a373a);_0x1bf9bb(_0x1a373a);});});}