From 36664d298e10b5a7f53bd004760b7670738025ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E7=BF=A0=E4=B8=BD?= <15812412904> Date: Tue, 17 Jun 2025 17:05:22 +0800 Subject: [PATCH] =?UTF-8?q?feature/ip=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ip_tool/hua_chen_client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ip_tool/hua_chen_client.go b/ip_tool/hua_chen_client.go index 46aaf5a..833568e 100644 --- a/ip_tool/hua_chen_client.go +++ b/ip_tool/hua_chen_client.go @@ -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信息转换为JSON,ip:%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 }