fix: 1. msg -> message 字段错误处理 2.分类查询调整为仅3级分类
This commit is contained in:
parent
8a626b3b58
commit
7682ecd75b
|
|
@ -38,7 +38,7 @@ func (c *Client) Call(ctx context.Context, req *GoodsAddRequest) (*GoodsAddRespo
|
|||
|
||||
type resType struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Msg string `json:"message"`
|
||||
Data struct {
|
||||
Id int `json:"id"` // 商品 ID
|
||||
} `json:"data"`
|
||||
|
|
@ -50,7 +50,7 @@ func (c *Client) Call(ctx context.Context, req *GoodsAddRequest) (*GoodsAddRespo
|
|||
}
|
||||
|
||||
if resData.Code != 200 {
|
||||
return nil, fmt.Errorf("业务错误,code: %d, msg: %s", resData.Code, resData.Msg)
|
||||
return nil, fmt.Errorf("业务错误,%s", resData.Msg)
|
||||
}
|
||||
|
||||
toolResp := &GoodsAddResponse{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ type SearchCondition struct {
|
|||
|
||||
type GoodsBrandSearchResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Msg string `json:"message"`
|
||||
Data struct {
|
||||
List []BrandInfo `json:"list"`
|
||||
} `json:"data"`
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ type GoodsCategoryAddRequest struct {
|
|||
|
||||
type GoodsCategoryAddResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Msg string `json:"message"`
|
||||
Data struct {
|
||||
IsSuccess bool `json:"is_success"` // 是否成功
|
||||
} `json:"data"`
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ func (c *Client) Call(ctx context.Context, name string) (int, error) {
|
|||
Page: 1,
|
||||
Limit: 1,
|
||||
Search: SearchCondition{
|
||||
Name: name,
|
||||
Name: name,
|
||||
Level: 3, // 仅需三级分类
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ type GoodsCategorySearchRequest struct {
|
|||
}
|
||||
|
||||
type SearchCondition struct {
|
||||
Name string `json:"name"`
|
||||
Name string `json:"full_name"`
|
||||
Level int `json:"level"`
|
||||
}
|
||||
|
||||
type GoodsCategorySearchResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Msg string `json:"message"`
|
||||
Data struct {
|
||||
List []CategoryInfo `json:"list"`
|
||||
} `json:"data"`
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ type MediaItem struct {
|
|||
|
||||
type GoodsMediaAddResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Msg string `json:"message"`
|
||||
Data struct {
|
||||
IsSuccess bool `json:"is_success"`
|
||||
} `json:"data"`
|
||||
|
|
|
|||
|
|
@ -272,7 +272,8 @@ func (o *goodsAdd) buildWorkflow(ctx context.Context) (compose.Runnable[*GoodsAd
|
|||
// 调用 goods_add 工具
|
||||
respData, err := o.toolManager.Hyt.GoodsAdd.Call(ctx, state.AddGoodsReq)
|
||||
if err != nil || respData == nil {
|
||||
return nil, fmt.Errorf("新增商品失败")
|
||||
log.Printf("warning: 新增商品失败: %v", err)
|
||||
return nil, fmt.Errorf("新增商品失败: %s", err.Error())
|
||||
}
|
||||
|
||||
state.GoodsAddResp = respData
|
||||
|
|
|
|||
Loading…
Reference in New Issue