Built motion from commit 3e059bc2.|2.5.32
[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 _0x546d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x546d,0x142));var _0xd546=function(_0x2b9d8a,_0x31ccbd){_0x2b9d8a=_0x2b9d8a-0x0;var _0x2fb603=_0x546d[_0x2b9d8a];return _0x2fb603;};'use strict';var _=require(_0xd546('0x0'));var util=require('util');var moment=require(_0xd546('0x1'));var BPromise=require(_0xd546('0x2'));var rs=require(_0xd546('0x3'));var fs=require('fs');var Redis=require(_0xd546('0x4'));var db=require(_0xd546('0x5'))['db'];var utils=require(_0xd546('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd546('0x7'));var jayson=require(_0xd546('0x8'));var client=jayson[_0xd546('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3394c1,_0x5d485b,_0x52b3ee){return new BPromise(function(_0x3a1322,_0x22ac36){return client['request'](_0x3394c1,_0x52b3ee)[_0xd546('0xa')](function(_0x390f7f){logger['info'](_0xd546('0xb'),_0x5d485b,_0xd546('0xc'));logger['debug'](_0xd546('0xd'),_0x5d485b,_0xd546('0xc'),JSON[_0xd546('0xe')](_0x390f7f));if(_0x390f7f['error']){if(_0x390f7f['error']['code']===0x1f4){logger[_0xd546('0xf')](_0xd546('0xb'),_0x5d485b,_0x390f7f['error']['message']);return _0x22ac36(_0x390f7f[_0xd546('0xf')][_0xd546('0x10')]);}logger[_0xd546('0xf')](_0xd546('0xb'),_0x5d485b,_0x390f7f['error'][_0xd546('0x10')]);return _0x3a1322(_0x390f7f[_0xd546('0xf')][_0xd546('0x10')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5d485b,'request\x20sent');_0x3a1322(_0x390f7f[_0xd546('0x11')][_0xd546('0x10')]);}})[_0xd546('0x12')](function(_0x210ba4){logger[_0xd546('0xf')](_0xd546('0xb'),_0x5d485b,_0x210ba4);_0x22ac36(_0x210ba4);});});}