23900db4c6c39c4c07a0b36dd6a822f834d65842
[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 _0x2219=['error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','request\x20sent','stringify','code'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0x2219,0x9d));var _0x9221=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x2219[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x9221('0x0'));var util=require(_0x9221('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9221('0x2'));var fs=require('fs');var Redis=require(_0x9221('0x3'));var db=require(_0x9221('0x4'))['db'];var utils=require(_0x9221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9221('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9221('0x7')][_0x9221('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24546e,_0x4801b5,_0xef7a38){return new BPromise(function(_0x4a1c77,_0x3bdc6e){return client['request'](_0x24546e,_0xef7a38)[_0x9221('0x9')](function(_0x435bde){logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'),JSON[_0x9221('0xc')](_0x435bde));if(_0x435bde['error']){if(_0x435bde['error'][_0x9221('0xd')]===0x1f4){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')][_0x9221('0x10')]);return _0x3bdc6e(_0x435bde[_0x9221('0xe')]['message']);}logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')]['message']);return _0x4a1c77(_0x435bde[_0x9221('0xe')]['message']);}else{logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));_0x4a1c77(_0x435bde[_0x9221('0x11')]['message']);}})[_0x9221('0x12')](function(_0x86231f){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x86231f);_0x3bdc6e(_0x86231f);});});}