5fde25e07fc2b0832350ce09ffb040e0a594d8a6
[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 _0xe83a=['AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe83a,0x113));var _0xae83=function(_0x47b112,_0x55e216){_0x47b112=_0x47b112-0x0;var _0x8e4e43=_0xe83a[_0x47b112];return _0x8e4e43;};'use strict';var _=require('lodash');var util=require(_0xae83('0x0'));var moment=require('moment');var BPromise=require(_0xae83('0x1'));var rs=require(_0xae83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae83('0x4'))('rpc');var config=require(_0xae83('0x5'));var jayson=require(_0xae83('0x6'));var client=jayson[_0xae83('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edc40,_0x15c7b4,_0x2beb9d){return new BPromise(function(_0x41bda9,_0x3c5f3d){return client[_0xae83('0x8')](_0x4edc40,_0x2beb9d)['then'](function(_0x223358){logger[_0xae83('0x9')](_0xae83('0xa'),_0x15c7b4,_0xae83('0xb'));logger[_0xae83('0xc')](_0xae83('0xd'),_0x15c7b4,_0xae83('0xb'),JSON['stringify'](_0x223358));if(_0x223358['error']){if(_0x223358['error']['code']===0x1f4){logger[_0xae83('0xe')](_0xae83('0xa'),_0x15c7b4,_0x223358[_0xae83('0xe')][_0xae83('0xf')]);return _0x3c5f3d(_0x223358['error'][_0xae83('0xf')]);}logger[_0xae83('0xe')](_0xae83('0xa'),_0x15c7b4,_0x223358[_0xae83('0xe')][_0xae83('0xf')]);return _0x41bda9(_0x223358[_0xae83('0xe')]['message']);}else{logger[_0xae83('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x15c7b4,_0xae83('0xb'));_0x41bda9(_0x223358['result'][_0xae83('0xf')]);}})['catch'](function(_0x29fb43){logger[_0xae83('0xe')](_0xae83('0xa'),_0x15c7b4,_0x29fb43);_0x3c5f3d(_0x29fb43);});});}