Built motion from commit d5e4af8c.|2.6.23
[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 _0x5283=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3f7e76,_0x512f5f){var _0x4565bb=function(_0x1af414){while(--_0x1af414){_0x3f7e76['push'](_0x3f7e76['shift']());}};_0x4565bb(++_0x512f5f);}(_0x5283,0x143));var _0x3528=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x5283[_0x3e21f4];return _0x40fc49;};'use strict';var _=require('lodash');var util=require(_0x3528('0x0'));var moment=require(_0x3528('0x1'));var BPromise=require('bluebird');var rs=require(_0x3528('0x2'));var fs=require('fs');var Redis=require(_0x3528('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3528('0x4'))(_0x3528('0x5'));var config=require(_0x3528('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3528('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x390988,_0x401ed5,_0x5b0438){return new BPromise(function(_0x2ba11f,_0x13c0ab){return client[_0x3528('0x8')](_0x390988,_0x5b0438)['then'](function(_0x5622a9){logger[_0x3528('0x9')](_0x3528('0xa'),_0x401ed5,'request\x20sent');logger[_0x3528('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x401ed5,_0x3528('0xc'),JSON[_0x3528('0xd')](_0x5622a9));if(_0x5622a9[_0x3528('0xe')]){if(_0x5622a9[_0x3528('0xe')][_0x3528('0xf')]===0x1f4){logger['error'](_0x3528('0xa'),_0x401ed5,_0x5622a9['error'][_0x3528('0x10')]);return _0x13c0ab(_0x5622a9['error'][_0x3528('0x10')]);}logger[_0x3528('0xe')](_0x3528('0xa'),_0x401ed5,_0x5622a9[_0x3528('0xe')][_0x3528('0x10')]);return _0x2ba11f(_0x5622a9[_0x3528('0xe')]['message']);}else{logger[_0x3528('0x9')](_0x3528('0xa'),_0x401ed5,_0x3528('0xc'));_0x2ba11f(_0x5622a9[_0x3528('0x11')][_0x3528('0x10')]);}})[_0x3528('0x12')](function(_0x37daf5){logger[_0x3528('0xe')](_0x3528('0xa'),_0x401ed5,_0x37daf5);_0x13c0ab(_0x37daf5);});});}