diff --git a/common/price_compoent/price_util.go b/common/price_compoent/price_util.go index 2d797b1..287588e 100644 --- a/common/price_compoent/price_util.go +++ b/common/price_compoent/price_util.go @@ -71,10 +71,8 @@ func GetPriceUsd(tokenType global_const.TokenType) (float64, error) { bodystr := string(body) strarr := strings.Split(bodystr, ":") usdstr := strings.TrimRight(strarr[2], "}}") - err := res.Body.Close() - if err != nil { - logrus.Errorf("close body error: %v", err) - } + defer res.Body.Close() + return strconv.ParseFloat(usdstr, 64) }