28e8c301b988ecf4a55317ff438005fa76f07b00
[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 _0x906f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment'];(function(_0x145b97,_0x4a6c61){var _0x5ed773=function(_0x7feeca){while(--_0x7feeca){_0x145b97['push'](_0x145b97['shift']());}};_0x5ed773(++_0x4a6c61);}(_0x906f,0x1ae));var _0xf906=function(_0x432c9e,_0x44c740){_0x432c9e=_0x432c9e-0x0;var _0x323a2b=_0x906f[_0x432c9e];return _0x323a2b;};'use strict';var _=require('lodash');var util=require(_0xf906('0x0'));var moment=require(_0xf906('0x1'));var BPromise=require('bluebird');var rs=require(_0xf906('0x2'));var fs=require('fs');var Redis=require(_0xf906('0x3'));var db=require(_0xf906('0x4'))['db'];var utils=require(_0xf906('0x5'));var logger=require(_0xf906('0x6'))('rpc');var config=require(_0xf906('0x7'));var jayson=require(_0xf906('0x8'));var client=jayson['client'][_0xf906('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37fd72,_0x535e0b,_0x55160f){return new BPromise(function(_0x3a998d,_0x55c6a9){return client['request'](_0x37fd72,_0x55160f)[_0xf906('0xa')](function(_0x4c2061){logger['info'](_0xf906('0xb'),_0x535e0b,'request\x20sent');logger['debug'](_0xf906('0xc'),_0x535e0b,'request\x20sent',JSON['stringify'](_0x4c2061));if(_0x4c2061[_0xf906('0xd')]){if(_0x4c2061[_0xf906('0xd')][_0xf906('0xe')]===0x1f4){logger[_0xf906('0xd')](_0xf906('0xb'),_0x535e0b,_0x4c2061['error']['message']);return _0x55c6a9(_0x4c2061[_0xf906('0xd')][_0xf906('0xf')]);}logger[_0xf906('0xd')](_0xf906('0xb'),_0x535e0b,_0x4c2061[_0xf906('0xd')]['message']);return _0x3a998d(_0x4c2061[_0xf906('0xd')][_0xf906('0xf')]);}else{logger[_0xf906('0x10')](_0xf906('0xb'),_0x535e0b,'request\x20sent');_0x3a998d(_0x4c2061['result'][_0xf906('0xf')]);}})[_0xf906('0x11')](function(_0x5b20ef){logger['error'](_0xf906('0xb'),_0x535e0b,_0x5b20ef);_0x55c6a9(_0x5b20ef);});});}