Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -2,6 +2,7 @@ package shop_getStoreFreight_request
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
shop_getStoreFreight_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreFreight/response"
|
shop_getStoreFreight_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreFreight/response"
|
||||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||||
)
|
)
|
||||||
@@ -27,6 +28,7 @@ func New() *ShopGetStoreFreightRequest {
|
|||||||
|
|
||||||
func (c *ShopGetStoreFreightRequest) Execute(accessToken *doudian_sdk.AccessToken) (*shop_getStoreFreight_response.ShopGetStoreFreightResponse, error) {
|
func (c *ShopGetStoreFreightRequest) Execute(accessToken *doudian_sdk.AccessToken) (*shop_getStoreFreight_response.ShopGetStoreFreightResponse, error) {
|
||||||
responseJson, err := c.GetClient().Request(c, accessToken)
|
responseJson, err := c.GetClient().Request(c, accessToken)
|
||||||
|
fmt.Println(responseJson)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ type WarehouseGetWarehouseByStoreResponse struct {
|
|||||||
doudian_sdk.BaseDoudianOpApiResponse
|
doudian_sdk.BaseDoudianOpApiResponse
|
||||||
Data *WarehouseGetWarehouseByStoreData `json:"data"`
|
Data *WarehouseGetWarehouseByStoreData `json:"data"`
|
||||||
}
|
}
|
||||||
type WarehouseGetWarehouseByStoreData struct {
|
|
||||||
// 仓信息map
|
|
||||||
WarehouseInfoMap map[int64][]WarehouseInfoMapItem `json:"warehouse_info_map"`
|
|
||||||
}
|
|
||||||
type WarehouseLocation struct {
|
type WarehouseLocation struct {
|
||||||
// 一级地址ID
|
// 一级地址ID
|
||||||
AddressId1 int64 `json:"address_id1"`
|
AddressId1 int64 `json:"address_id1"`
|
||||||
@@ -53,4 +49,12 @@ type WarehouseInfoMapItem struct {
|
|||||||
WarehouseType int64 `json:"warehouse_type"`
|
WarehouseType int64 `json:"warehouse_type"`
|
||||||
// 绑定的外部围栏ID列表
|
// 绑定的外部围栏ID列表
|
||||||
OutFenceIds []string `json:"out_fence_ids"`
|
OutFenceIds []string `json:"out_fence_ids"`
|
||||||
|
Latitude float64 `json:"latitude"`
|
||||||
|
Longitude float64 `json:"longitude"`
|
||||||
|
Addresses []string `json:"addresses"`
|
||||||
|
StoreNames []string `json:"store_names"`
|
||||||
|
}
|
||||||
|
type WarehouseGetWarehouseByStoreData struct {
|
||||||
|
// 仓信息map
|
||||||
|
WarehouseInfoMap map[int64][]WarehouseInfoMapItem `json:"warehouse_info_map"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
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":"c4afc5bc-7ddf-4244-b35a-0c393f3dca32","expires_in":1667203717,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a4f9dfe-306b-4bca-8b35-2ae9afc0245e","authority_id":""}`
|
||||||
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "")
|
||||||
|
|
||||||
// 查询售后单详情
|
// 查询售后单详情
|
||||||
func TestAfsOrder(t *testing.T) {
|
func TestAfsOrder(t *testing.T) {
|
||||||
|
|||||||
@@ -267,10 +267,11 @@ func (a *API) GetStoreFreight(storeId int64) ([]int64, error) {
|
|||||||
if result.Code != RequestSuccessCode {
|
if result.Code != RequestSuccessCode {
|
||||||
return nil, errors.New(result.SubMsg)
|
return nil, errors.New(result.SubMsg)
|
||||||
}
|
}
|
||||||
if len(result.Data.StoreFreights) == 0 {
|
tempList := make([]int64, 0)
|
||||||
return []int64{0}, err
|
if utils.IsNil(result.Data) {
|
||||||
|
tempList = append(tempList, 0)
|
||||||
|
return tempList, err
|
||||||
} else {
|
} else {
|
||||||
tempList := make([]int64, 0)
|
|
||||||
for _, v := range result.Data.StoreFreights {
|
for _, v := range result.Data.StoreFreights {
|
||||||
tempList = append(tempList, v.FreightId)
|
tempList = append(tempList, v.FreightId)
|
||||||
}
|
}
|
||||||
@@ -359,7 +360,7 @@ func (a *API) GetWarehouseByStore(storeID int64) (map[int64][]warehouse_getWareh
|
|||||||
if response.Code != RequestSuccessCode {
|
if response.Code != RequestSuccessCode {
|
||||||
return nil, errors.New(response.Msg + "," + response.SubMsg)
|
return nil, errors.New(response.Msg + "," + response.SubMsg)
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("response.Data.WarehouseInfoMap==========%d", response.Data.WarehouseInfoMap)
|
globals.SugarLogger.Debugf("response.Data.WarehouseInfoMap==========%v", response.Data.WarehouseInfoMap)
|
||||||
if len(response.Data.WarehouseInfoMap) == 0 {
|
if len(response.Data.WarehouseInfoMap) == 0 {
|
||||||
return nil, errors.New(fmt.Sprintf("门店%d 暂时未绑定仓库,请进行绑定!", storeID))
|
return nil, errors.New(fmt.Sprintf("门店%d 暂时未绑定仓库,请进行绑定!", storeID))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ func TestUpdateStore(t *testing.T) {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
func TestGetStoreBindFreight(t *testing.T) {
|
func TestGetStoreBindFreight(t *testing.T) {
|
||||||
accesstoken := `{"access_token":"47690a84-3cc2-4958-abf9-41cc7fca5f82","expires_in":1666862533,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"66ea2395-07c7-409d-84ae-93ac1e600b74","authority_id":""}`
|
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":""}`
|
||||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
var a2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||||
resp, err := a.GetStoreFreight(668619)
|
resp, err := a2.GetStoreFreight(64251634)
|
||||||
fmt.Println(resp)
|
fmt.Println(resp)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@@ -272,3 +272,11 @@ func TestStoreUpdateFence(t *testing.T) {
|
|||||||
fmt.Printf("%f,%f\n", Longitude, Latitude)
|
fmt.Printf("%f,%f\n", Longitude, Latitude)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetWarehouseByStore(t *testing.T) {
|
||||||
|
accesstoken := `{"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":""}`
|
||||||
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||||
|
resp, err := a.GetWarehouseByStore(62490423)
|
||||||
|
fmt.Println(resp)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user