9b8e2e8cab3fad9a5dde11ed1d72299c0f30f268
[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 _0xab4c=['jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c4340,_0x357f3e){var _0x5d5889=function(_0x4e380a){while(--_0x4e380a){_0x4c4340['push'](_0x4c4340['shift']());}};_0x5d5889(++_0x357f3e);}(_0xab4c,0x158));var _0xcab4=function(_0x726624,_0x21f598){_0x726624=_0x726624-0x0;var _0x14fb9f=_0xab4c[_0x726624];return _0x14fb9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcab4('0x0'));var BPromise=require(_0xcab4('0x1'));var rs=require(_0xcab4('0x2'));var fs=require('fs');var Redis=require(_0xcab4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcab4('0x4'));var logger=require(_0xcab4('0x5'))(_0xcab4('0x6'));var config=require(_0xcab4('0x7'));var jayson=require(_0xcab4('0x8'));var client=jayson[_0xcab4('0x9')][_0xcab4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5112,_0x124513,_0x304daf){return new BPromise(function(_0x16a13f,_0x43ef64){return client[_0xcab4('0xb')](_0x1f5112,_0x304daf)[_0xcab4('0xc')](function(_0x6832c0){logger[_0xcab4('0xd')](_0xcab4('0xe'),_0x124513,_0xcab4('0xf'));logger['debug'](_0xcab4('0x10'),_0x124513,_0xcab4('0xf'),JSON[_0xcab4('0x11')](_0x6832c0));if(_0x6832c0[_0xcab4('0x12')]){if(_0x6832c0['error'][_0xcab4('0x13')]===0x1f4){logger['error'](_0xcab4('0xe'),_0x124513,_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);return _0x43ef64(_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);}logger[_0xcab4('0x12')](_0xcab4('0xe'),_0x124513,_0x6832c0['error'][_0xcab4('0x14')]);return _0x16a13f(_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);}else{logger[_0xcab4('0xd')](_0xcab4('0xe'),_0x124513,_0xcab4('0xf'));_0x16a13f(_0x6832c0['result'][_0xcab4('0x14')]);}})[_0xcab4('0x15')](function(_0x44dae7){logger[_0xcab4('0x12')](_0xcab4('0xe'),_0x124513,_0x44dae7);_0x43ef64(_0x44dae7);});});}