311cee816ffe1e4161cc8999ecad801bc1c63f12
[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 _0x255a=['request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4256c5,_0x56c872){var _0x25c84a=function(_0x3d65fd){while(--_0x3d65fd){_0x4256c5['push'](_0x4256c5['shift']());}};_0x25c84a(++_0x56c872);}(_0x255a,0x145));var _0xa255=function(_0x416a54,_0x1ff2b4){_0x416a54=_0x416a54-0x0;var _0x1c438a=_0x255a[_0x416a54];return _0x1c438a;};'use strict';var _=require('lodash');var util=require(_0xa255('0x0'));var moment=require(_0xa255('0x1'));var BPromise=require(_0xa255('0x2'));var rs=require(_0xa255('0x3'));var fs=require('fs');var Redis=require(_0xa255('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa255('0x5'));var logger=require(_0xa255('0x6'))(_0xa255('0x7'));var config=require(_0xa255('0x8'));var jayson=require(_0xa255('0x9'));var client=jayson[_0xa255('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x497eb9,_0x1ac22b,_0x289fda){return new BPromise(function(_0x5d5e0d,_0xf07367){return client[_0xa255('0xb')](_0x497eb9,_0x289fda)[_0xa255('0xc')](function(_0x245475){logger[_0xa255('0xd')](_0xa255('0xe'),_0x1ac22b,_0xa255('0xf'));logger[_0xa255('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1ac22b,_0xa255('0xf'),JSON['stringify'](_0x245475));if(_0x245475['error']){if(_0x245475[_0xa255('0x11')][_0xa255('0x12')]===0x1f4){logger[_0xa255('0x11')](_0xa255('0xe'),_0x1ac22b,_0x245475['error'][_0xa255('0x13')]);return _0xf07367(_0x245475[_0xa255('0x11')][_0xa255('0x13')]);}logger[_0xa255('0x11')](_0xa255('0xe'),_0x1ac22b,_0x245475[_0xa255('0x11')]['message']);return _0x5d5e0d(_0x245475[_0xa255('0x11')][_0xa255('0x13')]);}else{logger['info'](_0xa255('0xe'),_0x1ac22b,'request\x20sent');_0x5d5e0d(_0x245475[_0xa255('0x14')][_0xa255('0x13')]);}})['catch'](function(_0x50a28f){logger[_0xa255('0x11')](_0xa255('0xe'),_0x1ac22b,_0x50a28f);_0xf07367(_0x50a28f);});});}