创建门店错误处理

This commit is contained in:
苏尹岚
2020-05-15 16:13:22 +08:00
parent f972503364
commit d8662a6da4

View File

@@ -1,6 +1,8 @@
package jdshopapi
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
)
@@ -36,6 +38,9 @@ type GetAddressCodeResult struct {
func (a *API) CreateEntityStore(createEntityStoreParam *CreateEntityStoreParam) (vendorStoreID string, err error) {
result, err := a.AccessAPI("jingdong.createEntityStore", prodURL, utils.Struct2FlatMap(createEntityStoreParam))
if err == nil {
if !result["jingdong_createEntityStore_responce"].(map[string]interface{})["createentitystore_result"].(map[string]interface{})["success"].(bool) {
return vendorStoreID, fmt.Errorf(result["jingdong_createEntityStore_responce"].(map[string]interface{})["createentitystore_result"].(map[string]interface{})["message"].(string))
}
return result["jingdong_createEntityStore_responce"].(map[string]interface{})["createentitystore_result"].(map[string]interface{})["result"].(map[string]interface{})["name"].(string), err
}
return vendorStoreID, err