This commit is contained in:
richboo111
2023-02-22 14:51:26 +08:00
parent ba4d653eab
commit 41ffd293b6
2 changed files with 17 additions and 16 deletions

View File

@@ -301,16 +301,20 @@ func (a *API) GetStoreFreight(storeId int64) ([]int64, error) {
return nil, errors.New(result.SubMsg)
}
tempList := make([]int64, 0)
if len(result.Data.StoreFreights) == 0 {
globals.SugarLogger.Debugf("绑定运费模板为空可判断")
tempList = append(tempList, 0)
return tempList, err
} else {
for _, v := range result.Data.StoreFreights {
tempList = append(tempList, v.FreightId)
}
return tempList, err
//if len(result.Data.StoreFreights) == 0 {
// globals.SugarLogger.Debugf("绑定运费模板为空可判断")
// tempList = append(tempList, 0)
// return tempList, err
//} else {
for _, v := range result.Data.StoreFreights {
tempList = append(tempList, v.FreightId)
}
if len(tempList) == 0 {
tempList = append(tempList, 0)
}
return tempList, err
//}
}
//获取运费模板详情

View File

@@ -10,6 +10,7 @@ import (
shop_bindStoreSaleLimit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/request"
shop_editStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_editStore/request"
shop_getStoreDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreDetail/request"
shop_getStoreFreight_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreFreight/response"
shop_getStoreList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreList/request"
shop_storeSuspend_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_storeSuspend/request"
shop_unsuspendStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_unsuspendStore/request"
@@ -395,7 +396,7 @@ func TestUpdateFreightTemplate(t *testing.T) {
func TestGetStoreBindFreight(t *testing.T) {
var token = `{"access_token":"e1c4333c-6e5e-4db8-83d3-173923e0815f","expires_in":1677450559,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"89d62aee-5bb3-433c-9514-e435172a3263","authority_id":""}`
var a2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
resp, err := a2.GetStoreFreight(64251217)
resp, err := a2.GetStoreFreight(86794746)
fmt.Println(resp)
fmt.Println(err)
}
@@ -415,15 +416,11 @@ type t2 struct {
}
func TestCheckNil(t *testing.T) {
var data = test{}
var check = &data.t
var data = &shop_getStoreFreight_response.ShopGetStoreFreightData{}
if utils.IsNil(data) {
fmt.Println("isNil可判断")
}
if len(data.t.age1) == 0 {
fmt.Println("len可判断")
}
if check == nil {
if data == nil {
fmt.Println("check可判断")
}
}