0c714b5d6039b611994dbc6787423edda09c7557
[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 _0x7c5d=['../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3c9c2e,_0x1e7d40){var _0x269196=function(_0x1cb3c7){while(--_0x1cb3c7){_0x3c9c2e['push'](_0x3c9c2e['shift']());}};_0x269196(++_0x1e7d40);}(_0x7c5d,0xb0));var _0xd7c5=function(_0x5644aa,_0x44fbd4){_0x5644aa=_0x5644aa-0x0;var _0x1d4024=_0x7c5d[_0x5644aa];return _0x1d4024;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd7c5('0x0'));var BPromise=require(_0xd7c5('0x1'));var rs=require(_0xd7c5('0x2'));var fs=require('fs');var Redis=require(_0xd7c5('0x3'));var db=require(_0xd7c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7c5('0x5'))(_0xd7c5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd7c5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a0629,_0x17bf07,_0x1f558a){return new BPromise(function(_0xc28415,_0x21dc59){return client[_0xd7c5('0x8')](_0x1a0629,_0x1f558a)[_0xd7c5('0x9')](function(_0x106548){logger[_0xd7c5('0xa')]('AnalyticTreeReport,\x20%s,\x20%s',_0x17bf07,_0xd7c5('0xb'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x17bf07,'request\x20sent',JSON[_0xd7c5('0xc')](_0x106548));if(_0x106548[_0xd7c5('0xd')]){if(_0x106548[_0xd7c5('0xd')]['code']===0x1f4){logger[_0xd7c5('0xd')](_0xd7c5('0xe'),_0x17bf07,_0x106548['error'][_0xd7c5('0xf')]);return _0x21dc59(_0x106548['error']['message']);}logger['error'](_0xd7c5('0xe'),_0x17bf07,_0x106548[_0xd7c5('0xd')][_0xd7c5('0xf')]);return _0xc28415(_0x106548[_0xd7c5('0xd')]['message']);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x17bf07,_0xd7c5('0xb'));_0xc28415(_0x106548[_0xd7c5('0x10')]['message']);}})[_0xd7c5('0x11')](function(_0x10d184){logger[_0xd7c5('0xd')](_0xd7c5('0xe'),_0x17bf07,_0x10d184);_0x21dc59(_0x10d184);});});}