diff --git a/ip_tool/hua_chen_client.go b/ip_tool/hua_chen_client.go index bcfafa0..a85f701 100644 --- a/ip_tool/hua_chen_client.go +++ b/ip_tool/hua_chen_client.go @@ -114,7 +114,7 @@ func (h *HuaChenIpClient) GetIpInfoFormCache(ctx context.Context, ip string, opt return nil, errors.Wrapf(err, "无法将IP信息转换为JSON,ip:%s", ip) } - if len(opt) == 0 { + if len(opt) != 0 { err = h.cache.Set(ctx, h.ipKey(ip), string(infoJson), opt[0]) if err != nil { return nil, errors.Wrapf(err, "缓存ip:%s信息失败,", ip)