Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / analyticDefaultReport / analyticDefaultReport.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 _0x9411=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x1c6250,_0x4ba01d){var _0x5e2f3a=function(_0x84f05f){while(--_0x84f05f){_0x1c6250['push'](_0x1c6250['shift']());}};_0x5e2f3a(++_0x4ba01d);}(_0x9411,0x1a1));var _0x1941=function(_0x3d1651,_0x3d9693){_0x3d1651=_0x3d1651-0x0;var _0x163dad=_0x9411[_0x3d1651];return _0x163dad;};'use strict';var _=require(_0x1941('0x0'));var util=require(_0x1941('0x1'));var moment=require(_0x1941('0x2'));var BPromise=require('bluebird');var rs=require(_0x1941('0x3'));var fs=require('fs');var Redis=require(_0x1941('0x4'));var db=require(_0x1941('0x5'))['db'];var utils=require(_0x1941('0x6'));var logger=require(_0x1941('0x7'))(_0x1941('0x8'));var config=require('../../config/environment');var jayson=require(_0x1941('0x9'));var client=jayson[_0x1941('0xa')][_0x1941('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15846e,_0x2b400b,_0x1514a6){return new BPromise(function(_0xda8392,_0x49ddbc){return client['request'](_0x15846e,_0x1514a6)[_0x1941('0xc')](function(_0x47d528){logger['info'](_0x1941('0xd'),_0x2b400b,_0x1941('0xe'));logger[_0x1941('0xf')](_0x1941('0x10'),_0x2b400b,_0x1941('0xe'),JSON[_0x1941('0x11')](_0x47d528));if(_0x47d528[_0x1941('0x12')]){if(_0x47d528[_0x1941('0x12')][_0x1941('0x13')]===0x1f4){logger[_0x1941('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2b400b,_0x47d528['error'][_0x1941('0x14')]);return _0x49ddbc(_0x47d528[_0x1941('0x12')][_0x1941('0x14')]);}logger[_0x1941('0x12')](_0x1941('0xd'),_0x2b400b,_0x47d528[_0x1941('0x12')][_0x1941('0x14')]);return _0xda8392(_0x47d528[_0x1941('0x12')]['message']);}else{logger[_0x1941('0x15')](_0x1941('0xd'),_0x2b400b,_0x1941('0xe'));_0xda8392(_0x47d528['result'][_0x1941('0x14')]);}})['catch'](function(_0x4924f8){logger[_0x1941('0x12')](_0x1941('0xd'),_0x2b400b,_0x4924f8);_0x49ddbc(_0x4924f8);});});}