b0204fc466103aa04ce642ccb89dd4246456839a
[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 _0x60f4=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x4dff23,_0x2edcba){var _0x47c6ca=function(_0x5db532){while(--_0x5db532){_0x4dff23['push'](_0x4dff23['shift']());}};_0x47c6ca(++_0x2edcba);}(_0x60f4,0xbc));var _0x460f=function(_0x5bebbe,_0x4340f6){_0x5bebbe=_0x5bebbe-0x0;var _0x16e5bf=_0x60f4[_0x5bebbe];return _0x16e5bf;};'use strict';var _=require(_0x460f('0x0'));var util=require('util');var moment=require(_0x460f('0x1'));var BPromise=require(_0x460f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x460f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x460f('0x4'));var logger=require(_0x460f('0x5'))(_0x460f('0x6'));var config=require(_0x460f('0x7'));var jayson=require(_0x460f('0x8'));var client=jayson[_0x460f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383f12,_0x21346d,_0x28054c){return new BPromise(function(_0x2049cd,_0x5186f5){return client[_0x460f('0xa')](_0x383f12,_0x28054c)[_0x460f('0xb')](function(_0x3585c8){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,'request\x20sent');logger['debug'](_0x460f('0xc'),_0x21346d,_0x460f('0xd'),JSON['stringify'](_0x3585c8));if(_0x3585c8['error']){if(_0x3585c8[_0x460f('0xe')][_0x460f('0xf')]===0x1f4){logger[_0x460f('0xe')](_0x460f('0x10'),_0x21346d,_0x3585c8[_0x460f('0xe')][_0x460f('0x11')]);return _0x5186f5(_0x3585c8['error'][_0x460f('0x11')]);}logger[_0x460f('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x3585c8[_0x460f('0xe')][_0x460f('0x11')]);return _0x2049cd(_0x3585c8['error'][_0x460f('0x11')]);}else{logger[_0x460f('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x460f('0xd'));_0x2049cd(_0x3585c8[_0x460f('0x13')]['message']);}})[_0x460f('0x14')](function(_0x4fa734){logger[_0x460f('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x4fa734);_0x5186f5(_0x4fa734);});});}