feature/ip优化

This commit is contained in:
吕翠丽 2025-06-17 17:05:22 +08:00
parent 0bbbfa3c1e
commit 36664d298e

View File

@ -98,12 +98,13 @@ func (h *HuaChenIpClient) GetIpInfoFormCache(ctx context.Context, ip string, ttl
if getCache != nil {
return getCache, nil
}
info, err := h.GetIpInfo(ip)
res, err = h.GetIpInfo(ip)
if err != nil {
return nil, errors.Wrapf(err, "获取ip:%s信息失败", ip)
}
infoJson, err := json.Marshal(info)
var infoJson []byte
infoJson, err = json.Marshal(res)
if err != nil {
return nil, errors.Wrapf(err, "无法将IP信息转换为JSONip:%s", ip)
}
@ -112,7 +113,6 @@ func (h *HuaChenIpClient) GetIpInfoFormCache(ctx context.Context, ip string, ttl
if err != nil {
return nil, errors.Wrapf(err, "缓存ip:%s信息失败", ip)
}
res = info
return
}