diff --git a/upstream/hdh/hdh_goods.go b/upstream/hdh/hdh_goods.go index 1bde7328c3d16024c8f47ebef3e4b189b7cea5d8..2461b2e66c9269c58911983cb2cd381ea8e0453c 100644 --- a/upstream/hdh/hdh_goods.go +++ b/upstream/hdh/hdh_goods.go @@ -2,7 +2,7 @@ package hdh import ( "context" - "encoding/json" + "github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/net/ghttp" ) @@ -214,7 +214,10 @@ func GetGoodsList(ctx context.Context, req *GoodsListReq) (res *GoodsListRes, er if nil != err { return } - err = json.Unmarshal([]byte(result), &res) + //err = json.Unmarshal([]byte(result), &res) + err = gjson.NewWithOptions([]byte(result), gjson.Options{ + StrNumber: true, + }).Scan(&res) return } @@ -225,7 +228,10 @@ func GetGoodsInfo(ctx context.Context, req *GoodsInfoReq) (res *GoodsInfoRes, er if nil != err { return } - err = json.Unmarshal([]byte(result), &res) + //err = json.Unmarshal([]byte(result), &res) + err = gjson.NewWithOptions([]byte(result), gjson.Options{ + StrNumber: true, + }).Scan(&res) return } @@ -235,6 +241,9 @@ func GoodsCallBack(r *ghttp.Request) (res *GoodsNotifyRes, err error) { if nil != err { return } - err = json.Unmarshal([]byte(body), &res) + //err = json.Unmarshal([]byte(body), &res) + err = gjson.NewWithOptions([]byte(body), gjson.Options{ + StrNumber: true, + }).Scan(&res) return }