f08e8c190a7af57e58db5ec8a413c540b4c877a2
[motion2.git] / server / api / analyticTreeReport / analyticTreeReport.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 _0x0863=['rpc','client','http','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x500c64,_0x5e83f5){var _0x56829c=function(_0xce3a40){while(--_0xce3a40){_0x500c64['push'](_0x500c64['shift']());}};_0x56829c(++_0x5e83f5);}(_0x0863,0xf1));var _0x3086=function(_0x2e9199,_0x2a3e51){_0x2e9199=_0x2e9199-0x0;var _0xb2e8db=_0x0863[_0x2e9199];return _0xb2e8db;};'use strict';var _=require(_0x3086('0x0'));var util=require(_0x3086('0x1'));var moment=require(_0x3086('0x2'));var BPromise=require('bluebird');var rs=require(_0x3086('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3086('0x4'))['db'];var utils=require(_0x3086('0x5'));var logger=require('../../config/logger')(_0x3086('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3086('0x7')][_0x3086('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cc5a6,_0x1cc681,_0x2809e6){return new BPromise(function(_0x16e547,_0x238e7d){return client['request'](_0x1cc5a6,_0x2809e6)[_0x3086('0x9')](function(_0x2e85b9){logger['info'](_0x3086('0xa'),_0x1cc681,_0x3086('0xb'));logger[_0x3086('0xc')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x1cc681,'request\x20sent',JSON[_0x3086('0xd')](_0x2e85b9));if(_0x2e85b9[_0x3086('0xe')]){if(_0x2e85b9[_0x3086('0xe')][_0x3086('0xf')]===0x1f4){logger[_0x3086('0xe')](_0x3086('0xa'),_0x1cc681,_0x2e85b9[_0x3086('0xe')][_0x3086('0x10')]);return _0x238e7d(_0x2e85b9[_0x3086('0xe')]['message']);}logger['error'](_0x3086('0xa'),_0x1cc681,_0x2e85b9[_0x3086('0xe')][_0x3086('0x10')]);return _0x16e547(_0x2e85b9['error'][_0x3086('0x10')]);}else{logger[_0x3086('0x11')](_0x3086('0xa'),_0x1cc681,_0x3086('0xb'));_0x16e547(_0x2e85b9['result'][_0x3086('0x10')]);}})[_0x3086('0x12')](function(_0x36534c){logger['error'](_0x3086('0xa'),_0x1cc681,_0x36534c);_0x238e7d(_0x36534c);});});}