f5506f917460c736c72ebb6226a8e05549444583
[motion2.git] / server / api / analyticMetric / analyticMetric.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 _0x16cb=['message','AnalyticMetric,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','debug','request\x20sent','stringify','error','code'];(function(_0x35b036,_0x4eaaf7){var _0x706824=function(_0x5e4b84){while(--_0x5e4b84){_0x35b036['push'](_0x35b036['shift']());}};_0x706824(++_0x4eaaf7);}(_0x16cb,0xae));var _0xb16c=function(_0x55a51e,_0x4eedbd){_0x55a51e=_0x55a51e-0x0;var _0x496d0e=_0x16cb[_0x55a51e];return _0x496d0e;};'use strict';var _=require(_0xb16c('0x0'));var util=require('util');var moment=require(_0xb16c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb16c('0x2'));var fs=require('fs');var Redis=require(_0xb16c('0x3'));var db=require(_0xb16c('0x4'))['db'];var utils=require(_0xb16c('0x5'));var logger=require(_0xb16c('0x6'))(_0xb16c('0x7'));var config=require(_0xb16c('0x8'));var jayson=require(_0xb16c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3811,_0x1448a8,_0x5a8885){return new BPromise(function(_0x73384e,_0x44bd05){return client['request'](_0x4b3811,_0x5a8885)['then'](function(_0x39320e){logger[_0xb16c('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,'request\x20sent');logger[_0xb16c('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1448a8,_0xb16c('0xc'),JSON[_0xb16c('0xd')](_0x39320e));if(_0x39320e[_0xb16c('0xe')]){if(_0x39320e[_0xb16c('0xe')][_0xb16c('0xf')]===0x1f4){logger[_0xb16c('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x44bd05(_0x39320e['error']['message']);}logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x73384e(_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);}else{logger[_0xb16c('0xa')](_0xb16c('0x11'),_0x1448a8,_0xb16c('0xc'));_0x73384e(_0x39320e[_0xb16c('0x12')][_0xb16c('0x10')]);}})['catch'](function(_0x234565){logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x234565);_0x44bd05(_0x234565);});});}