Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / analyticFieldReport / analyticFieldReport.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 _0x23a9=['then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x23a9,0x106));var _0x923a=function(_0x49d4f9,_0x3e89c9){_0x49d4f9=_0x49d4f9-0x0;var _0x446d07=_0x23a9[_0x49d4f9];return _0x446d07;};'use strict';var _=require(_0x923a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x923a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x923a('0x2'));var logger=require(_0x923a('0x3'))(_0x923a('0x4'));var config=require(_0x923a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x923a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58ed12,_0x54333e,_0x31de8c){return new BPromise(function(_0x11ed4c,_0x1e3fd7){return client[_0x923a('0x7')](_0x58ed12,_0x31de8c)[_0x923a('0x8')](function(_0x8a9ec1){logger['info'](_0x923a('0x9'),_0x54333e,'request\x20sent');logger[_0x923a('0xa')](_0x923a('0xb'),_0x54333e,_0x923a('0xc'),JSON['stringify'](_0x8a9ec1));if(_0x8a9ec1[_0x923a('0xd')]){if(_0x8a9ec1[_0x923a('0xd')][_0x923a('0xe')]===0x1f4){logger[_0x923a('0xd')](_0x923a('0x9'),_0x54333e,_0x8a9ec1[_0x923a('0xd')][_0x923a('0xf')]);return _0x1e3fd7(_0x8a9ec1['error'][_0x923a('0xf')]);}logger[_0x923a('0xd')](_0x923a('0x9'),_0x54333e,_0x8a9ec1[_0x923a('0xd')]['message']);return _0x11ed4c(_0x8a9ec1[_0x923a('0xd')][_0x923a('0xf')]);}else{logger['info'](_0x923a('0x9'),_0x54333e,_0x923a('0xc'));_0x11ed4c(_0x8a9ec1[_0x923a('0x10')][_0x923a('0xf')]);}})[_0x923a('0x11')](function(_0x3d507f){logger[_0x923a('0xd')](_0x923a('0x9'),_0x54333e,_0x3d507f);_0x1e3fd7(_0x3d507f);});});}