From ba4d653eab6af42d4057815004b8143c7c0cfc39 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 22 Feb 2023 14:24:18 +0800 Subject: [PATCH] 1 --- platformapi/jdshopapi/order2.go | 2 -- platformapi/tiktok_shop/tiktok_api/store.go | 3 +- .../tiktok_shop/tiktok_api/store_test.go | 32 +++++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/platformapi/jdshopapi/order2.go b/platformapi/jdshopapi/order2.go index de788b5f..5391ba34 100644 --- a/platformapi/jdshopapi/order2.go +++ b/platformapi/jdshopapi/order2.go @@ -51,8 +51,6 @@ func (a *API) GetOrderById(orderID int64, isStatus bool) (getOrderResult *GetEnO } result, err := a.AccessAPI("jingdong.pop.order.enGet", prodURL2, params) - globals.SugarLogger.Debugf("===result :%s", utils.Format4Output(result, false)) - globals.SugarLogger.Debugf("===err :%v", err) if err == nil { utils.Map2StructByJson(result["jingdong_pop_order_enGet_responce"].(map[string]interface{})["orderDetailInfo"].(map[string]interface{})["orderInfo"], &getOrderResult, false) } diff --git a/platformapi/tiktok_shop/tiktok_api/store.go b/platformapi/tiktok_shop/tiktok_api/store.go index 53e7e129..dbe42bdd 100644 --- a/platformapi/tiktok_shop/tiktok_api/store.go +++ b/platformapi/tiktok_shop/tiktok_api/store.go @@ -301,7 +301,8 @@ func (a *API) GetStoreFreight(storeId int64) ([]int64, error) { return nil, errors.New(result.SubMsg) } tempList := make([]int64, 0) - if utils.IsNil(result.Data) { + if len(result.Data.StoreFreights) == 0 { + globals.SugarLogger.Debugf("绑定运费模板为空可判断") tempList = append(tempList, 0) return tempList, err } else { diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index 8ccfdeda..86887990 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -393,13 +393,41 @@ func TestUpdateFreightTemplate(t *testing.T) { //获取门店运费模板 func TestGetStoreBindFreight(t *testing.T) { - var token = `{"access_token":"d590b649-0dd9-4988-a5e2-bf7e06e2f105","expires_in":1667808519,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f57c6a55-af5f-45ca-8ade-b2282be86341","authority_id":""}` + 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(64251634) + resp, err := a2.GetStoreFreight(64251217) fmt.Println(resp) fmt.Println(err) } +//能否判空 +type test struct { + name string + age string + t t1 +} +type t1 struct { + age1 []t2 +} +type t2 struct { + s1 string + s2 string +} + +func TestCheckNil(t *testing.T) { + var data = test{} + var check = &data.t + if utils.IsNil(data) { + fmt.Println("isNil可判断") + } + if len(data.t.age1) == 0 { + fmt.Println("len可判断") + } + if check == nil { + fmt.Println("check可判断") + } +} + //仓库 //创建单个仓库 func TestCreateWarehouse(t *testing.T) {