Built motion from commit 9e1399f3.|2.5.37
[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 _0xe134=['rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x13fa84,_0x1054c0){var _0x2b3f04=function(_0x5c895f){while(--_0x5c895f){_0x13fa84['push'](_0x13fa84['shift']());}};_0x2b3f04(++_0x1054c0);}(_0xe134,0x135));var _0x4e13=function(_0x5dedf5,_0x20c96e){_0x5dedf5=_0x5dedf5-0x0;var _0x4a30f0=_0xe134[_0x5dedf5];return _0x4a30f0;};'use strict';var _=require(_0x4e13('0x0'));var util=require(_0x4e13('0x1'));var moment=require(_0x4e13('0x2'));var BPromise=require(_0x4e13('0x3'));var rs=require(_0x4e13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e13('0x5'))(_0x4e13('0x6'));var config=require(_0x4e13('0x7'));var jayson=require(_0x4e13('0x8'));var client=jayson['client'][_0x4e13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ca904,_0x5c26eb,_0x6a54a9){return new BPromise(function(_0x20b77a,_0x32415c){return client['request'](_0x4ca904,_0x6a54a9)['then'](function(_0x1bf3f9){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5c26eb,_0x4e13('0xa'));logger[_0x4e13('0xb')](_0x4e13('0xc'),_0x5c26eb,_0x4e13('0xa'),JSON[_0x4e13('0xd')](_0x1bf3f9));if(_0x1bf3f9['error']){if(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0xf')]===0x1f4){logger[_0x4e13('0xe')](_0x4e13('0x10'),_0x5c26eb,_0x1bf3f9['error'][_0x4e13('0x11')]);return _0x32415c(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0x11')]);}logger['error'](_0x4e13('0x10'),_0x5c26eb,_0x1bf3f9['error'][_0x4e13('0x11')]);return _0x20b77a(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0x11')]);}else{logger[_0x4e13('0x12')](_0x4e13('0x10'),_0x5c26eb,_0x4e13('0xa'));_0x20b77a(_0x1bf3f9[_0x4e13('0x13')][_0x4e13('0x11')]);}})[_0x4e13('0x14')](function(_0x311895){logger[_0x4e13('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5c26eb,_0x311895);_0x32415c(_0x311895);});});}