Commit 826c9ab4 authored by huangjiamin's avatar huangjiamin

购买后将海外的IP添加KCP端口号 + own白名单

parent b06977e9
......@@ -670,7 +670,7 @@ public class IpResourceServiceImpl implements IpResourceService {
// 1. 如果 ip 资源的 addr 非空
if (StringUtils.isNotBlank(x.getAddr())) {
// 1.1 锁定时间在 2分钟内 且 IpType 为 VENDOR 且 (IP资源状态 为 0:正常 或 2:即将过期)
if (x.getLockTimestamp() >= Instant.now().minusSeconds(2 * 60).toEpochMilli() && x.getIpType() == IpType.VENDOR && (x.getStatus() == 0 || x.getStatus() == 2)) {
if (x.getLockTimestamp() >= Instant.now().minusSeconds(1 * 60).toEpochMilli() && x.getIpType() == IpType.VENDOR && (x.getStatus() == 0 || x.getStatus() == 2)) {
x.setStatus(3);
// 1.2 ip资源在未来七天内到期,且 ip 资源的状态不是 3(正在分配)、5(已失效)、6(未分配),则将 ip 资源设置为 2(即将过期)
......@@ -713,10 +713,6 @@ public class IpResourceServiceImpl implements IpResourceService {
x.setStatus(3);
}
if(x.isSpecialLine() && x.getStatus() == 0 && x.getPurchasedTime() > (Instant.now().minusSeconds(14 * 60).toEpochMilli())) {
x.setSpecialLine(false);
}
// 3. 如果 ip 资源的 status 为 3(正在分配)
if (x.getStatus() == 3) {
x.setAddr("");
......
......@@ -394,10 +394,16 @@ public class ShopServiceImpl implements ShopService {
ipResourceDto = new IpResourceDto(ipResource, null, false);
}
if(org.apache.commons.lang3.StringUtils.isNotBlank(ipResource.getRegion()) && region.contains(ipResource.getRegion())){
//海外设置KCP端口
if (org.apache.commons.lang3.StringUtils.isNotBlank(ipResource.getRegion()) && region.contains(ipResource.getRegion())) {
ipResourceDto.setSecondaryProxyPort("20020");
}
//刚购买14分钟内的专线设置为不可用
if (ipResource.getStatus() == 0 && ipResource.getPurchasedTime() > (Instant.now().minusSeconds(14 * 60).toEpochMilli())) {
ipResource.setSpecialLine(false);
}
// 3. 封装 ShopResultDto 信息并返回
return ShopResultDto.of(shop, userShop.getGroupId(), ipResourceDto);
}
......
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