optimizer: 更新域名映射接口返回值和前端页面显示
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
<span>{{ scope.row.protocal }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.domainName')" width="180">
|
||||
<el-table-column align="center" :label="$t('table.domainName')" width="190">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="(domain, index) in scope.row.allFullDomainList" :key="index">
|
||||
<span>{{ domain }}</span>
|
||||
@@ -432,23 +432,25 @@ export default {
|
||||
// 初始化 domainMappings 字段
|
||||
item.domainMappings = [];
|
||||
// 检查是否存在 subdomain 和 domain 字段
|
||||
if (item.subdomains && item.domainIds && item.domains) {
|
||||
// 如果是数组,则按索引组合 subdomain 和 domain 成对象
|
||||
if (Array.isArray(item.subdomains) && Array.isArray(item.domainIds) && Array.isArray(item.domains)) {
|
||||
let allFullDomainList = []
|
||||
for (let i = 0; i < item.subdomains.length; i++) {
|
||||
item.domainMappings.push({
|
||||
subdomain: item.subdomains[i] || '', // 使用 || '' 保证字段非空
|
||||
domainId: item.domainIds[i] || '',
|
||||
domain: item.domains[i] || ''
|
||||
});
|
||||
// 拼接完整的域名
|
||||
const fullDomain = `${item.subdomains[i]}.${item.domains[i]}`;
|
||||
// 将拼接后的域名添加到 allFullDomains 中,以逗号分隔
|
||||
allFullDomainList.push(fullDomain);
|
||||
if (item.fullDomainMappings && Array.isArray(item.fullDomainMappings)) {
|
||||
let allFullDomainList = []
|
||||
for (const fullDomainMapping of item.fullDomainMappings) {
|
||||
item.domainMappings.push({
|
||||
subdomain: fullDomainMapping.subdomain || '', // 使用 || '' 保证字段非空
|
||||
domainId: fullDomainMapping.domainNameId || '',
|
||||
domain: fullDomainMapping.domain || ''
|
||||
});
|
||||
// 拼接完整的域名
|
||||
let fullDomain = null;
|
||||
if (fullDomainMapping.forceHttps == 1) {
|
||||
fullDomain = `https://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
|
||||
} else {
|
||||
fullDomain = `http://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
|
||||
}
|
||||
item.allFullDomainList = allFullDomainList
|
||||
// 将拼接后的域名添加到
|
||||
allFullDomainList.push(fullDomain);
|
||||
}
|
||||
item.allFullDomainList = allFullDomainList
|
||||
}
|
||||
return item;
|
||||
});
|
||||
@@ -575,7 +577,7 @@ export default {
|
||||
handleOpenWebPage(row) {
|
||||
let url = location.protocol + '//' + location.hostname + ':' + row.serverPort
|
||||
if (row.allFullDomainList && row.allFullDomainList.length > 0) {
|
||||
url = location.protocol + '//' + row.allFullDomainList[0]
|
||||
url = row.allFullDomainList[0]
|
||||
}
|
||||
open(url)
|
||||
},
|
||||
|
||||
+4
-12
@@ -21,10 +21,10 @@
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -45,18 +45,10 @@ public class PortMappingListRes {
|
||||
* 协议
|
||||
*/
|
||||
private String protocal;
|
||||
/**
|
||||
* 子域名集合
|
||||
*/
|
||||
private List<String> subdomains;
|
||||
/**
|
||||
* 域名集合
|
||||
* 完整域名映射
|
||||
*/
|
||||
private List<String> domains;
|
||||
/**
|
||||
* 域名id集合
|
||||
*/
|
||||
private List<Integer> domainIds;
|
||||
private List<FullDomainNameBO> fullDomainMappings;
|
||||
/**
|
||||
* license名称
|
||||
*/
|
||||
|
||||
-3
@@ -1,7 +1,5 @@
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -26,7 +24,6 @@ import org.dromara.neutrinoproxy.server.dal.DomainPortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainPortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.proxy.enhance.SslContextManager;
|
||||
|
||||
+2
-10
@@ -132,16 +132,8 @@ public class PortMappingService implements LifecycleBean {
|
||||
return;
|
||||
}
|
||||
item.setUserName(user.getName());
|
||||
List<FullDomainNameBO> bos = fullDomainNameBOMap.get(item.getId());
|
||||
// TODO 后续重构域名映射返回值结构
|
||||
if (CollectionUtil.isNotEmpty(bos)) {
|
||||
List<String> subdomains = bos.stream().map(FullDomainNameBO::getSubdomain).collect(Collectors.toList());
|
||||
List<String> domains = bos.stream().map(FullDomainNameBO::getDomain).collect(Collectors.toList());
|
||||
List<Integer> domainIds = bos.stream().map(FullDomainNameBO::getDomainNameId).collect(Collectors.toList());
|
||||
item.setSubdomains(subdomains);
|
||||
item.setDomains(domains);
|
||||
item.setDomainIds(domainIds);
|
||||
}
|
||||
//域名映射
|
||||
item.setFullDomainMappings(fullDomainNameBOMap.get(item.getId()));
|
||||
if (NetworkProtocolEnum.HTTP.getDesc().equals(item.getProtocal())) {
|
||||
item.setProtocal("HTTP(S)");
|
||||
}
|
||||
|
||||
+4
-6
@@ -20,16 +20,14 @@ public class FullDomainNameBO {
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 域名id
|
||||
*/
|
||||
private Integer domainNameId;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
/**
|
||||
* 强制使用HTTPS(1、是 2、否)
|
||||
* {@link HttpsStatusEnum}
|
||||
|
||||
Reference in New Issue
Block a user