1
This commit is contained in:
@@ -2,15 +2,19 @@ package tao_vegetable
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request"
|
||||
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (a API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
// GetStoreAllCategory 获取门店所有分类
|
||||
|
||||
// GetStoreCategoryInfo 获取门店指定分类
|
||||
func (a *API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryQuery(&request.AlibabaWdkSkuCategoryQueryRequest{Param: &domain.AlibabaWdkSkuCategoryQueryCategoryDo{Code: &code}}, "")
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryQuery(&request.AlibabaWdkSkuCategoryQueryRequest{Param: &domain.AlibabaWdkSkuCategoryQueryCategoryDo{Code: &code}}, a.token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -25,19 +29,15 @@ func (a API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (a API) AddStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryAddRequest) (*CategoryInfo, error) {
|
||||
func (a *API) AddStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryAddRequest) (string, error) {
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryAdd(param, "258adasdad222aa")
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryAdd(param, a.token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
if resp.Result.ErrMsg != nil {
|
||||
return nil, fmt.Errorf("requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrMsg)
|
||||
}
|
||||
var info *CategoryInfo
|
||||
if err := json.Unmarshal([]byte(*resp.Result.Model), &info); err != nil {
|
||||
return nil, err
|
||||
return "", fmt.Errorf("requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrMsg)
|
||||
}
|
||||
|
||||
return info, nil
|
||||
return *resp.Result.Model, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user