Built motion from commit (unavailable).|2.5.4
[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 _0x533b=['../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4580d4,_0xb4514f){var _0x48ce72=function(_0x35194e){while(--_0x35194e){_0x4580d4['push'](_0x4580d4['shift']());}};_0x48ce72(++_0xb4514f);}(_0x533b,0x183));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb533('0x0'));var util=require(_0xb533('0x1'));var moment=require(_0xb533('0x2'));var BPromise=require('bluebird');var rs=require(_0xb533('0x3'));var fs=require('fs');var Redis=require(_0xb533('0x4'));var db=require(_0xb533('0x5'))['db'];var utils=require(_0xb533('0x6'));var logger=require(_0xb533('0x7'))(_0xb533('0x8'));var config=require(_0xb533('0x9'));var jayson=require(_0xb533('0xa'));var client=jayson[_0xb533('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8cc6,_0x55f4f3,_0x158db0){return new BPromise(function(_0x59dc61,_0x153dff){return client['request'](_0x2d8cc6,_0x158db0)[_0xb533('0xc')](function(_0x446481){logger[_0xb533('0xd')](_0xb533('0xe'),_0x55f4f3,_0xb533('0xf'));logger[_0xb533('0x10')](_0xb533('0x11'),_0x55f4f3,_0xb533('0xf'),JSON[_0xb533('0x12')](_0x446481));if(_0x446481[_0xb533('0x13')]){if(_0x446481[_0xb533('0x13')][_0xb533('0x14')]===0x1f4){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x446481[_0xb533('0x13')]['message']);return _0x153dff(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}logger[_0xb533('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0x446481[_0xb533('0x13')][_0xb533('0x15')]);return _0x59dc61(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0xb533('0xf'));_0x59dc61(_0x446481['result'][_0xb533('0x15')]);}})['catch'](function(_0x22f46f){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x22f46f);_0x153dff(_0x22f46f);});});}