Commit f616c2e3 by 孙香冬

no message

parent ced98d04
<config>
<port>30001</port>
<sockentPort>30002</sockentPort>
<rightView>
<ipPort>http://10.51.50.136:8090/sql/execute</ipPort>
</rightView>
<rightView>http://10.51.50.136:8090/sql/execute</rightView>
<leftView>
<cloudResource>http://10.51.50.140:8080/api/static/PrivateCloudUsageStatics</cloudResource>
<physicalResource>http://10.51.50.140:8080/api/v1/PrivateCloudCurrentUsages</physicalResource>
......
const path = require('path');
import * as fs from "fs";
import { SysError } from "../util/bizError";
import { BizError, SysError } from "../util/bizError";
import { analysisXml } from "../util/myXML";
import { SYSTEMERRORENUM } from "./errorEnum";
export let port = Number(process.env.PORT) || Number(process.argv[3]);
// export let = "http://10.51.50.140:8080/api/static/PrivateCloudUsageStatics";
// export let = "http://10.51.50.140:8080/api/v1/PrivateCloudCurrentUsages";
// export let = "http://10.51.48.213/nlink/v2/getAllDevicesInfo?prjid=0255e1f7515348cc87c7bb2cc6341fer&online=3&broken=3&token=09a98bc555474e058ef90b6cc6e23638";
export let sockentPort;
export let dbConfig;
export let appConfig = {
cloudResource:'',
physicalResource:'',
mapPort:''
rightView: 'http://10.51.50.136:8090/sql/execute',
cloudResource:'http://10.51.50.140:8080/api/static/PrivateCloudUsageStatics',
physicalResource:'http://10.51.50.140:8080/api/v1/PrivateCloudCurrentUsages',
mapPort:'http://10.51.48.213/nlink/v2/getAllDevicesInfo?prjid=0255e1f7515348cc87c7bb2cc6341fer&online=3&broken=3&token=09a98bc555474e058ef90b6cc6e23638'
};
export let mongoServerConstVal;
export let mySqlConfig;
......@@ -27,21 +25,21 @@ export async function initConfig() {
let configInfo:any = await analysisXml(configStr);
if (!configInfo || !configInfo.config) console.log("xml中无配置加载");
else {
let {port, sockentPort} = configInfo.config;
let {port, sockentPort, rightView, leftView, mapView} = configInfo.config;
if ( !getConf(port)) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 port');
if ( !getConf(sockentPort)) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 sockentPort');
if ( !getConf(rightView)) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 rightView');
if ( !getConf(leftView)) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 leftView');
if ( !getConf(mapView)) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 mapView');
if ( !getConf(port)|| !getConf(sockentPort) ) throw new SysError(SYSTEMERRORENUM.初始化配置失败, 'serverConfig.xml中 缺少 port 或 sockentPort');
//左屏
let leftView = config.leftView[0];
appConfig.cloudResource = leftView.cloudResource[0];
appConfig.physicalResource = leftView.physicalResource[0];
appConfig.cloudResource = leftView[0].cloudResource[0];
appConfig.physicalResource = leftView[0].physicalResource[0];
//地图
let mapView = config.mapView[0];
let online = mapView.online[0];
let broken = mapView.broken[0];
let token = mapView.token[0];
mapPort = mapView.mapPort[0] + "&online=" + online + "&broken=" + broken + "&token=" + token || mapPort;
let online = mapView[0].online[0];
let broken = mapView[0].broken[0];
let token = mapView[0].token[0];
appConfig.mapPort = mapView[0].mapPort[0] + "&online=" + online + "&broken=" + broken + "&token=" + token || appConfig.mapPort;
}
console.log("config init success");
......
import { ERRORENUM } from "../../config/errorEnum";
import { cloudResource, physicalResource } from "../../config/serverConfig";
import { appConfig } from "../../config/serverConfig";
import { BizError } from "../../util/bizError";
import { get } from "../../util/request";
//虚拟机上的数据
export async function getHardware() {
let 云资源result:any = await get(cloudResource);
let 使用率result:any = await get(physicalResource);
let 云资源result:any = await get(appConfig.cloudResource);
let 使用率result:any = await get(appConfig.physicalResource);
if (!云资源result) throw new BizError(ERRORENUM.未找到数据, "云资源");
if (!使用率result) throw new BizError(ERRORENUM.未找到数据, "使用率");
......
import { ERRORENUM } from "../../config/errorEnum";
import { appConfig } from "../../config/serverConfig";
import { BizError } from "../../util/bizError";
import { get } from "../../util/request";
export async function getMap() {
let data:any = await get("http://10.51.48.213/nlink/v2/getAllDevicesInfo?prjid=0255e1f7515348cc87c7bb2cc6341fer&online=3&broken=3&token=09a98bc555474e058ef90b6cc6e23638");
let data:any = await get(appConfig.mapPort);
if(!data) throw new BizError(ERRORENUM.未找到数据, "地图数据");
let cameraData = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment