a04e40be6e9f8b08dacab9a04345742cee898313
[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 _0x30d9=['info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x37b784,_0x505bc7){var _0x83240b=function(_0x9e169b){while(--_0x9e169b){_0x37b784['push'](_0x37b784['shift']());}};_0x83240b(++_0x505bc7);}(_0x30d9,0x191));var _0x930d=function(_0xa05b7f,_0x48c55d){_0xa05b7f=_0xa05b7f-0x0;var _0xa19f51=_0x30d9[_0xa05b7f];return _0xa19f51;};'use strict';var _=require(_0x930d('0x0'));var util=require(_0x930d('0x1'));var moment=require(_0x930d('0x2'));var BPromise=require(_0x930d('0x3'));var rs=require(_0x930d('0x4'));var fs=require('fs');var Redis=require(_0x930d('0x5'));var db=require(_0x930d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x930d('0x7'))(_0x930d('0x8'));var config=require(_0x930d('0x9'));var jayson=require(_0x930d('0xa'));var client=jayson[_0x930d('0xb')][_0x930d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42d194,_0xd07f08,_0x47f961){return new BPromise(function(_0x8ee9be,_0x2d9118){return client[_0x930d('0xd')](_0x42d194,_0x47f961)[_0x930d('0xe')](function(_0x57d569){logger[_0x930d('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0xd07f08,_0x930d('0x10'));logger[_0x930d('0x11')](_0x930d('0x12'),_0xd07f08,_0x930d('0x10'),JSON[_0x930d('0x13')](_0x57d569));if(_0x57d569[_0x930d('0x14')]){if(_0x57d569[_0x930d('0x14')][_0x930d('0x15')]===0x1f4){logger[_0x930d('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xd07f08,_0x57d569[_0x930d('0x14')][_0x930d('0x16')]);return _0x2d9118(_0x57d569[_0x930d('0x14')][_0x930d('0x16')]);}logger[_0x930d('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xd07f08,_0x57d569[_0x930d('0x14')]['message']);return _0x8ee9be(_0x57d569[_0x930d('0x14')]['message']);}else{logger['info'](_0x930d('0x17'),_0xd07f08,_0x930d('0x10'));_0x8ee9be(_0x57d569[_0x930d('0x18')][_0x930d('0x16')]);}})[_0x930d('0x19')](function(_0x5bf216){logger[_0x930d('0x14')](_0x930d('0x17'),_0xd07f08,_0x5bf216);_0x2d9118(_0x5bf216);});});}