849dc2923347a02239d9345a1ba657a3fde56d18
[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 _0x0fd3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0x0fd3,0xbe));var _0x30fd=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x0fd3[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x30fd('0x0'));var util=require(_0x30fd('0x1'));var moment=require(_0x30fd('0x2'));var BPromise=require(_0x30fd('0x3'));var rs=require(_0x30fd('0x4'));var fs=require('fs');var Redis=require(_0x30fd('0x5'));var db=require(_0x30fd('0x6'))['db'];var utils=require(_0x30fd('0x7'));var logger=require(_0x30fd('0x8'))('rpc');var config=require(_0x30fd('0x9'));var jayson=require(_0x30fd('0xa'));var client=jayson[_0x30fd('0xb')][_0x30fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x507f14,_0x420d4b,_0x4a5699){return new BPromise(function(_0x526fda,_0x624c7e){return client[_0x30fd('0xd')](_0x507f14,_0x4a5699)['then'](function(_0x3f0cfa){logger[_0x30fd('0xe')](_0x30fd('0xf'),_0x420d4b,_0x30fd('0x10'));logger[_0x30fd('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x420d4b,_0x30fd('0x10'),JSON[_0x30fd('0x12')](_0x3f0cfa));if(_0x3f0cfa[_0x30fd('0x13')]){if(_0x3f0cfa[_0x30fd('0x13')][_0x30fd('0x14')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x420d4b,_0x3f0cfa['error'][_0x30fd('0x15')]);return _0x624c7e(_0x3f0cfa[_0x30fd('0x13')]['message']);}logger[_0x30fd('0x13')](_0x30fd('0xf'),_0x420d4b,_0x3f0cfa[_0x30fd('0x13')][_0x30fd('0x15')]);return _0x526fda(_0x3f0cfa[_0x30fd('0x13')][_0x30fd('0x15')]);}else{logger['info'](_0x30fd('0xf'),_0x420d4b,_0x30fd('0x10'));_0x526fda(_0x3f0cfa[_0x30fd('0x16')][_0x30fd('0x15')]);}})[_0x30fd('0x17')](function(_0x5a4a0e){logger[_0x30fd('0x13')](_0x30fd('0xf'),_0x420d4b,_0x5a4a0e);_0x624c7e(_0x5a4a0e);});});}