feat:first commit

This commit is contained in:
Zhujx
2025-07-16 15:05:59 +08:00
parent ec437bb088
commit 767bce5ce8
16 changed files with 649 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package com.xiang.schedule;
import com.xiang.service.DomainServiceImpl;
import com.xiang.utils.IpUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @Author: xiang
* @Date: 2025-06-10 17:21
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class DynamicDomainSchedule {
private final DomainServiceImpl domainService;
@Scheduled(cron = "0 0/5 * * * ? ")
public void dynamicDomainSchedule() {
String publicIp = "";
try {
publicIp = IpUtils.getPublicIp();
} catch (Exception e) {
log.error("获取公网ip失败", e);
}
if (StringUtils.isNotBlank(publicIp)) {
try {
domainService.dynamicDomainAnalysis(publicIp);
} catch (Exception e) {
log.error("动态解析公网ip失败, ip:{}", publicIp, e);
}
}
}
}