提交 f2a07ce3 authored 作者: 赵雪如's avatar 赵雪如

自带gjson 部分情况会解析数据不对bool类型

上级 5b68ee63
......@@ -2,6 +2,7 @@ package tm
import (
"context"
"encoding/json"
link "github.com/alibabacloud-go/linkedmall-20220531/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
......@@ -47,9 +48,10 @@ func (s *category) QueryMallCategoryList(ctx context.Context,item int64) (res *Q
}
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
_ = gjson.NewWithOptions(result.Body, gjson.Options{
StrNumber: true,
}).Scan(&res)
a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil {
return
}
return
}
type CategoryListRes struct {
......
......@@ -2,6 +2,7 @@ package tm
import (
"context"
"encoding/json"
link "github.com/alibabacloud-go/linkedmall-20220531/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
......@@ -188,9 +189,10 @@ func (s *goodsTmNew) QueryItemDetailWithDivision(ctx context.Context,addr string
if *result.Body.Success ==false{
return
}
_ = gjson.NewWithOptions(result.Body, gjson.Options{
StrNumber: true,
}).Scan(&res)
a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil {
return
}
return
}
......@@ -217,9 +219,10 @@ func (s *goodsTmNew) ListDistributionItem(ctx context.Context,item *ListDistribu
}
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
_ = gjson.NewWithOptions(result.Body, gjson.Options{
StrNumber: true,
}).Scan(&res)
a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil {
return
}
return
}
......
......@@ -368,7 +368,10 @@ func (s *orderTm) Create(ctx context.Context,item *OrderCreateReq) (res *OrderCr
}
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
err =gjson.New(result.Body).Scan(&res)
a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil {
return
}
return
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论