36c305c1cd1511104f8c855414fb25759046d8f5
[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 _0x4819=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb9ac5,_0x4d9640){var _0x3d4bd8=function(_0x25ec21){while(--_0x25ec21){_0xb9ac5['push'](_0xb9ac5['shift']());}};_0x3d4bd8(++_0x4d9640);}(_0x4819,0xec));var _0x9481=function(_0x20dbe3,_0x2cc5b3){_0x20dbe3=_0x20dbe3-0x0;var _0x57b693=_0x4819[_0x20dbe3];return _0x57b693;};'use strict';var _=require(_0x9481('0x0'));var util=require(_0x9481('0x1'));var moment=require('moment');var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))('rpc');var config=require(_0x9481('0x8'));var jayson=require(_0x9481('0x9'));var client=jayson['client'][_0x9481('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b769f,_0x4ed818,_0xf007a0){return new BPromise(function(_0x440c8f,_0x5143f8){return client[_0x9481('0xb')](_0x2b769f,_0xf007a0)[_0x9481('0xc')](function(_0x4296bc){logger[_0x9481('0xd')](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4ed818,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x4296bc));if(_0x4296bc[_0x9481('0x11')]){if(_0x4296bc[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);return _0x5143f8(_0x4296bc[_0x9481('0x11')]['message']);}logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc['error'][_0x9481('0x13')]);return _0x440c8f(_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);}else{logger['info'](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));_0x440c8f(_0x4296bc[_0x9481('0x14')][_0x9481('0x13')]);}})[_0x9481('0x15')](function(_0x966cf9){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x966cf9);_0x5143f8(_0x966cf9);});});}