8e0b8519c64cc6e0510c517b17ceb60c01ed1bba
[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 _0x18d5=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x41c166,_0x41bda0){var _0x29c06c=function(_0x112228){while(--_0x112228){_0x41c166['push'](_0x41c166['shift']());}};_0x29c06c(++_0x41bda0);}(_0x18d5,0x9c));var _0x518d=function(_0x1b30bb,_0x283d23){_0x1b30bb=_0x1b30bb-0x0;var _0x4da755=_0x18d5[_0x1b30bb];return _0x4da755;};'use strict';var _=require('lodash');var util=require(_0x518d('0x0'));var moment=require(_0x518d('0x1'));var BPromise=require(_0x518d('0x2'));var rs=require(_0x518d('0x3'));var fs=require('fs');var Redis=require(_0x518d('0x4'));var db=require(_0x518d('0x5'))['db'];var utils=require(_0x518d('0x6'));var logger=require('../../config/logger')(_0x518d('0x7'));var config=require(_0x518d('0x8'));var jayson=require(_0x518d('0x9'));var client=jayson[_0x518d('0xa')][_0x518d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2937,_0x4d0d45,_0x5bf96e){return new BPromise(function(_0x58fd70,_0x4e17ae){return client[_0x518d('0xc')](_0x3e2937,_0x5bf96e)['then'](function(_0x448d1f){logger[_0x518d('0xd')](_0x518d('0xe'),_0x4d0d45,_0x518d('0xf'));logger['debug'](_0x518d('0x10'),_0x4d0d45,_0x518d('0xf'),JSON[_0x518d('0x11')](_0x448d1f));if(_0x448d1f['error']){if(_0x448d1f[_0x518d('0x12')][_0x518d('0x13')]===0x1f4){logger['error'](_0x518d('0xe'),_0x4d0d45,_0x448d1f[_0x518d('0x12')]['message']);return _0x4e17ae(_0x448d1f[_0x518d('0x12')][_0x518d('0x14')]);}logger[_0x518d('0x12')](_0x518d('0xe'),_0x4d0d45,_0x448d1f[_0x518d('0x12')][_0x518d('0x14')]);return _0x58fd70(_0x448d1f[_0x518d('0x12')]['message']);}else{logger[_0x518d('0xd')](_0x518d('0xe'),_0x4d0d45,_0x518d('0xf'));_0x58fd70(_0x448d1f[_0x518d('0x15')][_0x518d('0x14')]);}})[_0x518d('0x16')](function(_0x37225a){logger[_0x518d('0x12')](_0x518d('0xe'),_0x4d0d45,_0x37225a);_0x4e17ae(_0x37225a);});});}