Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohann0617 committed Apr 3, 2024
1 parent dd4d882 commit 90a1c1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -82,8 +83,7 @@ public void rmSingleDnsRecord(RmSingleDnsRecordParams params) {
@Override
public void addSingleDnsRecord(AddSingleDnsRecordParams params) {
Optional.ofNullable(proxyIpService.getById(params.getId())).ifPresent(proxyIp -> {
String prefix = EnumUtils.getEnumByCode(CountryEnum.class, proxyIp.getCountry()).getLowCode() + "."
+ cloudflareCfg.getProxyDomainPrefix();
String prefix = proxyIp.getCountry().toLowerCase(Locale.ROOT) + "." + cloudflareCfg.getProxyDomainPrefix();
apiService.addCfDnsRecords(
prefix,
proxyIp.getIp(),
Expand All @@ -102,8 +102,7 @@ public void addDnsRecordsBatch(AddDnsRecordsBatchParams params) {
Optional.ofNullable(proxyIpService.listByIds(params.getIds()))
.filter(CommonUtils::isNotEmpty).ifPresent(list -> {
list.parallelStream().forEach(proxyIp -> {
String prefix = EnumUtils.getEnumByCode(CountryEnum.class, proxyIp.getCountry()).getLowCode() + "."
+ cloudflareCfg.getProxyDomainPrefix();
String prefix = proxyIp.getCountry().toLowerCase(Locale.ROOT) + "." + cloudflareCfg.getProxyDomainPrefix();
apiService.addCfDnsRecords(
prefix,
proxyIp.getIp(),
Expand Down
12 changes: 7 additions & 5 deletions foreign-server/src/main/resources/static/proxyIp.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h2>代理IP列表</h2>
v-model="ipInfoParams"
class="input-with-select"
style="margin-top: 15px;">
<el-button slot="append" icon="el-icon-search" round @click="getIpInfo"></el-button>
<el-button slot="append" icon="el-icon-search" round @click="getIpInfo(ipInfoParams)"></el-button>
</el-input>
</el-collapse-item>
</el-collapse>
Expand Down Expand Up @@ -236,10 +236,12 @@ <h2>代理IP列表</h2>
<el-tag type="success" effect="warning">{{ scope.row.createTime }}</el-tag>
</template>
</el-table-column>
<el-table-column label="Action" fixed="right" width="120">
<el-table-column label="Action" fixed="right" width="250">
<template slot-scope="scope">
<el-button type="primary" round @click="addSingleDnsRecord(scope.row.ip)" size="mini">解析到CF
</el-button>
<el-button type="success" round @click="getIpInfo(scope.row.ip)" size="mini">获取IP信息
</el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -296,16 +298,16 @@ <h2>代理IP列表</h2>
})
.catch(error => console.error('Error searching data:', error));
},
getIpInfo() {
axios.post(`${this.apiUrl}/proxyIp/getIpInfo`, {ip: this.ipInfoParams})
getIpInfo(ip) {
axios.post(`${this.apiUrl}/proxyIp/getIpInfo`, {ip: ip})
.then(response => {
const responseData = JSON.parse(response.data.data);

let formattedData = "";
for (const key in responseData) {
formattedData += `| "${key}" : "${responseData[key]}"\n`;
}
this.$alert(formattedData, 'IP:' + this.ipInfoParams, {
this.$alert(formattedData, 'IP:' + ip+' 信息', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true, // 添加此行以允许 HTML 字符串
callback: action => {
Expand Down

0 comments on commit 90a1c1b

Please sign in to comment.