fix(auth): 修复用户注册和登录后缓存清理问题
Build docker and publish / build (20.15.1) (push) Successful in 6m43s

在用户注册、登录、修改订阅和删除订阅等操作后,添加清理服务器缓存的逻辑
同时修复电话重置密码验证码解析问题
This commit is contained in:
2025-11-01 09:31:38 -07:00
parent 49d3fc1c74
commit 01eab942fd
8 changed files with 82 additions and 5 deletions
+12
View File
@@ -55,6 +55,15 @@ var (
// GetRegionByIp queries the geolocation of an IP address using supported services.
func GetRegionByIp(ip string) (*GeoLocationResponse, error) {
// 如果是域名,先解析成 IP
if net.ParseIP(ip) == nil {
ips, err := GetIP(ip)
if err != nil || len(ips) == 0 {
return nil, errors.Wrap(err, "无法解析域名为IP")
}
ip = ips[0] // 取第一个解析到的IP
}
for service, enabled := range queryUrls {
if enabled {
response, err := fetchGeolocation(service, ip)
@@ -62,6 +71,9 @@ func GetRegionByIp(ip string) (*GeoLocationResponse, error) {
zap.S().Errorf("Failed to fetch geolocation from %s: %v", service, err)
continue
}
if response.Country == "" {
continue
}
return response, nil
}
}