2d04b6188c084cdfc7c6c31cebb813134e85877a
[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 _0xdd7e=['error','AnalyticMetric,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x381375,_0x1557df){var _0x2cfe1c=function(_0x2a2281){while(--_0x2a2281){_0x381375['push'](_0x381375['shift']());}};_0x2cfe1c(++_0x1557df);}(_0xdd7e,0x17d));var _0xedd7=function(_0x6fea4a,_0x20fa86){_0x6fea4a=_0x6fea4a-0x0;var _0x138fe3=_0xdd7e[_0x6fea4a];return _0x138fe3;};'use strict';var _=require(_0xedd7('0x0'));var util=require(_0xedd7('0x1'));var moment=require(_0xedd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xedd7('0x3'));var fs=require('fs');var Redis=require(_0xedd7('0x4'));var db=require(_0xedd7('0x5'))['db'];var utils=require(_0xedd7('0x6'));var logger=require(_0xedd7('0x7'))(_0xedd7('0x8'));var config=require(_0xedd7('0x9'));var jayson=require(_0xedd7('0xa'));var client=jayson[_0xedd7('0xb')][_0xedd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178df4,_0x59d1cc,_0x1441be){return new BPromise(function(_0x2c0fb1,_0x4fa5b3){return client[_0xedd7('0xd')](_0x178df4,_0x1441be)[_0xedd7('0xe')](function(_0x54ed2b){logger[_0xedd7('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x59d1cc,'request\x20sent');logger[_0xedd7('0x10')](_0xedd7('0x11'),_0x59d1cc,'request\x20sent',JSON[_0xedd7('0x12')](_0x54ed2b));if(_0x54ed2b[_0xedd7('0x13')]){if(_0x54ed2b[_0xedd7('0x13')]['code']===0x1f4){logger[_0xedd7('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x59d1cc,_0x54ed2b[_0xedd7('0x13')]['message']);return _0x4fa5b3(_0x54ed2b[_0xedd7('0x13')]['message']);}logger['error'](_0xedd7('0x14'),_0x59d1cc,_0x54ed2b[_0xedd7('0x13')][_0xedd7('0x15')]);return _0x2c0fb1(_0x54ed2b[_0xedd7('0x13')]['message']);}else{logger[_0xedd7('0xf')](_0xedd7('0x14'),_0x59d1cc,_0xedd7('0x16'));_0x2c0fb1(_0x54ed2b[_0xedd7('0x17')][_0xedd7('0x15')]);}})[_0xedd7('0x18')](function(_0xdc598d){logger['error'](_0xedd7('0x14'),_0x59d1cc,_0xdc598d);_0x4fa5b3(_0xdc598d);});});}