39e030a1137c454aa948ac21c1b3f2d86d917696
[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 _0xc541=['then','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x23dbb6,_0x25c89b){var _0x56ce38=function(_0x40e0df){while(--_0x40e0df){_0x23dbb6['push'](_0x23dbb6['shift']());}};_0x56ce38(++_0x25c89b);}(_0xc541,0x194));var _0x1c54=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0xc541[_0x493c8c];return _0x17344b;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c54('0x2'));var fs=require('fs');var Redis=require(_0x1c54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c54('0x4'));var logger=require(_0x1c54('0x5'))(_0x1c54('0x6'));var config=require(_0x1c54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c54('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a40b9,_0x34469e,_0x58af43){return new BPromise(function(_0x68e94d,_0x12db48){return client[_0x1c54('0x9')](_0x3a40b9,_0x58af43)[_0x1c54('0xa')](function(_0x156648){logger['info'](_0x1c54('0xb'),_0x34469e,'request\x20sent');logger['debug'](_0x1c54('0xc'),_0x34469e,_0x1c54('0xd'),JSON['stringify'](_0x156648));if(_0x156648['error']){if(_0x156648[_0x1c54('0xe')][_0x1c54('0xf')]===0x1f4){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x34469e,_0x156648[_0x1c54('0xe')]['message']);return _0x12db48(_0x156648[_0x1c54('0xe')]['message']);}logger[_0x1c54('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x34469e,_0x156648[_0x1c54('0xe')][_0x1c54('0x10')]);return _0x68e94d(_0x156648[_0x1c54('0xe')][_0x1c54('0x10')]);}else{logger['info'](_0x1c54('0xb'),_0x34469e,_0x1c54('0xd'));_0x68e94d(_0x156648[_0x1c54('0x11')][_0x1c54('0x10')]);}})['catch'](function(_0x31e303){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x34469e,_0x31e303);_0x12db48(_0x31e303);});});}