Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / analyticCustomReport / analyticCustomReport.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 _0x1d6e=['AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0x1d6e,0x119));var _0xe1d6=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x1d6e[_0x350258];return _0x3714b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1d6('0x0'));var BPromise=require(_0xe1d6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1d6('0x2'));var db=require(_0xe1d6('0x3'))['db'];var utils=require(_0xe1d6('0x4'));var logger=require(_0xe1d6('0x5'))(_0xe1d6('0x6'));var config=require(_0xe1d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1d6('0x8')][_0xe1d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d94bd,_0x1f0fc9,_0x5ce873){return new BPromise(function(_0x308479,_0x487c42){return client[_0xe1d6('0xa')](_0x4d94bd,_0x5ce873)[_0xe1d6('0xb')](function(_0x2580a4){logger[_0xe1d6('0xc')](_0xe1d6('0xd'),_0x1f0fc9,'request\x20sent');logger[_0xe1d6('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1f0fc9,_0xe1d6('0xf'),JSON['stringify'](_0x2580a4));if(_0x2580a4[_0xe1d6('0x10')]){if(_0x2580a4['error'][_0xe1d6('0x11')]===0x1f4){logger['error'](_0xe1d6('0xd'),_0x1f0fc9,_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);return _0x487c42(_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1f0fc9,_0x2580a4[_0xe1d6('0x10')][_0xe1d6('0x12')]);return _0x308479(_0x2580a4[_0xe1d6('0x10')]['message']);}else{logger[_0xe1d6('0xc')](_0xe1d6('0xd'),_0x1f0fc9,'request\x20sent');_0x308479(_0x2580a4[_0xe1d6('0x13')][_0xe1d6('0x12')]);}})[_0xe1d6('0x14')](function(_0x230b69){logger['error'](_0xe1d6('0xd'),_0x1f0fc9,_0x230b69);_0x487c42(_0x230b69);});});}