param
This commit is contained in:
@@ -181,7 +181,7 @@ func (a *API) UpdateTradeLimitTemplate(param *trade_UpdateTradeLimitTemplate_req
|
|||||||
response, err := request.Execute(a.accessTokenObj)
|
response, err := request.Execute(a.accessTokenObj)
|
||||||
globals.SugarLogger.Debugf("更新限售规则模板=========:%s", request.GetUrlPath())
|
globals.SugarLogger.Debugf("更新限售规则模板=========:%s", request.GetUrlPath())
|
||||||
globals.SugarLogger.Debugf("更新限售规则模板:=%s", utils.Format4Output(response, false))
|
globals.SugarLogger.Debugf("更新限售规则模板:=%s", utils.Format4Output(response, false))
|
||||||
globals.SugarLogger.Debugf("打印限售规则参数 检查%v", request.Param)
|
globals.SugarLogger.Debugf("打印限售规则参数 检查====%v", utils.Format4Output(request.Param, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -249,15 +249,14 @@ func (a *API) FreightTemplateUpdate(param *freightTemplate_update_request.Freigh
|
|||||||
response, err := request.Execute(a.accessTokenObj)
|
response, err := request.Execute(a.accessTokenObj)
|
||||||
globals.SugarLogger.Debugf("更新运费模板=========:%s", request.GetUrlPath())
|
globals.SugarLogger.Debugf("更新运费模板=========:%s", request.GetUrlPath())
|
||||||
globals.SugarLogger.Debugf("更新运费模板:=%s", utils.Format4Output(response, false))
|
globals.SugarLogger.Debugf("更新运费模板:=%s", utils.Format4Output(response, false))
|
||||||
globals.SugarLogger.Debugf("打印param 检查", request.Param)
|
globals.SugarLogger.Debugf("打印param 检查======%v", utils.Format4Output(request.Param, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if response.Code != RequestSuccessCode {
|
if response.Code != RequestSuccessCode {
|
||||||
return nil, errors.New(response.Msg + "," + response.SubMsg)
|
return nil, errors.New(response.Msg + "," + response.SubMsg)
|
||||||
}
|
}
|
||||||
|
return nil, nil
|
||||||
return response.Data, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 门店绑定运费模板 1对1
|
// 门店绑定运费模板 1对1
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package tiktok_api
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
freightTemplate_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_create/request"
|
freightTemplate_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_create/request"
|
||||||
|
freightTemplate_update_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_update/request"
|
||||||
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
|
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
|
||||||
shop_bindStoreSaleLimit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/request"
|
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_editStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_editStore/request"
|
||||||
@@ -22,6 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//创建店铺
|
||||||
func TestCreateStore(t *testing.T) {
|
func TestCreateStore(t *testing.T) {
|
||||||
accesstoken := `{"access_token":"c4afc5bc-7ddf-4244-b35a-0c393f3dca32","expires_in":1666862533,"scope":"SCOPE","shop_id":"57939570","shop_name":"京西菜市速食","refresh_token":"5a4f9dfe-306b-4bca-8b35-2ae9afc0245e","authority_id":""}`
|
accesstoken := `{"access_token":"c4afc5bc-7ddf-4244-b35a-0c393f3dca32","expires_in":1666862533,"scope":"SCOPE","shop_id":"57939570","shop_name":"京西菜市速食","refresh_token":"5a4f9dfe-306b-4bca-8b35-2ae9afc0245e","authority_id":""}`
|
||||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||||
@@ -104,50 +106,6 @@ func TestAPI_CreateTradeLimitTemplate(t *testing.T) {
|
|||||||
a.FreightTemplateCreate(tempDetail)
|
a.FreightTemplateCreate(tempDetail)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量创建区域仓
|
|
||||||
func TestCreateWarehouse(t *testing.T) {
|
|
||||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
|
||||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
|
||||||
|
|
||||||
data, err := a.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{
|
|
||||||
OutWarehouseList: []warehouse_createBatch_request.OutWarehouseListItem{
|
|
||||||
{
|
|
||||||
OutWarehouseId: "666668",
|
|
||||||
Name: "V派区域仓",
|
|
||||||
Intro: "VV派区域仓,仓库id为京西门店id",
|
|
||||||
AddressDetail: "四川省成都市金牛区万科加州湾V派",
|
|
||||||
WarehouseLocation: &warehouse_createBatch_request.WarehouseLocation{
|
|
||||||
AddressId1: 51,
|
|
||||||
AddressId2: 510100,
|
|
||||||
AddressId3: 510106,
|
|
||||||
AddressId4: 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}})
|
|
||||||
fmt.Println(data)
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仓库绑定门店
|
|
||||||
func TestBindWarehouseToStore(t *testing.T) {
|
|
||||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
|
||||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
|
||||||
|
|
||||||
data, err := a.StoreBindWarehouse(&warehouse_bindStore_request.WarehouseBindStoreParam{
|
|
||||||
StoreIds: []int64{65312663},
|
|
||||||
OutWarehouseId: "668510",
|
|
||||||
})
|
|
||||||
fmt.Println(data)
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仓库解绑门店
|
|
||||||
func TestUnBindd(t *testing.T) {
|
|
||||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
|
||||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
|
||||||
a.WarehouseUnbindStore([]int64{63114504}, "666667")
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建电子围栏
|
//创建电子围栏
|
||||||
func TestCreateFence(t *testing.T) {
|
func TestCreateFence(t *testing.T) {
|
||||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||||
@@ -257,25 +215,8 @@ func TestUpdateStore(t *testing.T) {
|
|||||||
err := a.EditStore(param)
|
err := a.EditStore(param)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
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 a2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
|
||||||
resp, err := a2.GetStoreFreight(64251634)
|
|
||||||
fmt.Println(resp)
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStoreUpdateFence(t *testing.T) {
|
|
||||||
tempStr := strings.Split("104.111331,30.67964544419017;104.13348225189759,30.671752134736078;104.14265760085712,30.652696;104.13348225189759,30.63363986526392;104.111331,30.625746555809826;104.08917974810242,30.63363986526392;104.0800043991429,30.652696;104.08917974810242,30.671752134736078", ";")
|
|
||||||
//fmt.Printf("%d", len(tempStr))
|
|
||||||
for v := len(tempStr) - 1; v >= 0; v-- {
|
|
||||||
s2 := strings.Split(tempStr[v], ",")
|
|
||||||
Longitude := utils.Str2Float64(s2[0])
|
|
||||||
Latitude := utils.Str2Float64(s2[1])
|
|
||||||
fmt.Printf("%f,%f\n", Longitude, Latitude)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//获取门店绑定仓库
|
||||||
func TestGetWarehouseByStore(t *testing.T) {
|
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":""}`
|
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)
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||||
@@ -289,11 +230,14 @@ func TestUtilsTime2Date(t *testing.T) {
|
|||||||
fmt.Println(time.Now().Day())
|
fmt.Println(time.Now().Day())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置门店打包费
|
||||||
func TestSetStorePackageFee(t *testing.T) {
|
func TestSetStorePackageFee(t *testing.T) {
|
||||||
err := a.SetStorePackageFee(62490423, 5) //单位 分
|
err := a.SetStorePackageFee(62490423, 5) //单位 分
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//限售模板
|
||||||
|
//创建起送价限售模板
|
||||||
func TestCreateMinPriceTemplate(t *testing.T) {
|
func TestCreateMinPriceTemplate(t *testing.T) {
|
||||||
param := &trade_createTradeLimitTemplate_request.TradeCreateTradeLimitTemplateParam{
|
param := &trade_createTradeLimitTemplate_request.TradeCreateTradeLimitTemplateParam{
|
||||||
StoreId: 62490423,
|
StoreId: 62490423,
|
||||||
@@ -311,6 +255,8 @@ func TestCreateMinPriceTemplate(t *testing.T) {
|
|||||||
fmt.Println(templateID)
|
fmt.Println(templateID)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//门店绑定限售模板
|
||||||
func TestStoreBindSaleTemplate(t *testing.T) {
|
func TestStoreBindSaleTemplate(t *testing.T) {
|
||||||
param := &shop_bindStoreSaleLimit_request.ShopBindStoreSaleLimitParam{
|
param := &shop_bindStoreSaleLimit_request.ShopBindStoreSaleLimitParam{
|
||||||
StoreId: 62490423,
|
StoreId: 62490423,
|
||||||
@@ -319,8 +265,110 @@ func TestStoreBindSaleTemplate(t *testing.T) {
|
|||||||
err := a.BindStoreSaleLimit(param)
|
err := a.BindStoreSaleLimit(param)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取门店限售模板
|
||||||
func TestGetStoreSaleLimit(t *testing.T) {
|
func TestGetStoreSaleLimit(t *testing.T) {
|
||||||
SaleLimitID, err := a.StoreQuerySaleLimitTemp(62490423)
|
SaleLimitID, err := a.StoreQuerySaleLimitTemp(62490423)
|
||||||
fmt.Println(SaleLimitID)
|
fmt.Println(SaleLimitID)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//电子围栏
|
||||||
|
//创建电子围栏
|
||||||
|
|
||||||
|
//更新电子围栏
|
||||||
|
func TestSplitFence(t *testing.T) {
|
||||||
|
tempStr := strings.Split("104.111331,30.67964544419017;104.13348225189759,30.671752134736078;104.14265760085712,30.652696;104.13348225189759,30.63363986526392;104.111331,30.625746555809826;104.08917974810242,30.63363986526392;104.0800043991429,30.652696;104.08917974810242,30.671752134736078", ";")
|
||||||
|
//fmt.Printf("%d", len(tempStr))
|
||||||
|
for v := len(tempStr) - 1; v >= 0; v-- {
|
||||||
|
s2 := strings.Split(tempStr[v], ",")
|
||||||
|
Longitude := utils.Str2Float64(s2[0])
|
||||||
|
Latitude := utils.Str2Float64(s2[1])
|
||||||
|
fmt.Printf("%f,%f\n", Longitude, Latitude)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//运费模板
|
||||||
|
//创建运费模板
|
||||||
|
|
||||||
|
//更新运费模板
|
||||||
|
func TestUpdateFreightTemplate(t *testing.T) {
|
||||||
|
param := &freightTemplate_update_request.FreightTemplateUpdateParam{
|
||||||
|
Template: &freightTemplate_update_request.Template{
|
||||||
|
Id: 11332268,
|
||||||
|
TemplateName: "京西菜市(盐田一店)_668619的运费模板",
|
||||||
|
ProductProvince: 44,
|
||||||
|
ProductCity: 440300,
|
||||||
|
CalculateType: 2, //计价方式-1.按重量 2.按数量
|
||||||
|
TransferType: 1,
|
||||||
|
RuleType: 1, //固定运费
|
||||||
|
FixedAmount: 500, //固定运费 单位:分
|
||||||
|
},
|
||||||
|
Columns: []freightTemplate_update_request.ColumnsItem{{
|
||||||
|
//RuleAddress: "{\"440000\":{\"440300\":{\"440306\":[0]}}}",
|
||||||
|
IsOverFree: true, //是否包邮
|
||||||
|
IsDefault: 0,
|
||||||
|
IsLimited: false,
|
||||||
|
OverAmount: 9900, //此字段在vendor_id=14时 存储满x包邮金额
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
templateID, err := a.FreightTemplateUpdate(param)
|
||||||
|
fmt.Println(templateID)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取门店运费模板
|
||||||
|
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 a2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||||
|
resp, err := a2.GetStoreFreight(64251634)
|
||||||
|
fmt.Println(resp)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
//仓库
|
||||||
|
//创建单个仓库
|
||||||
|
|
||||||
|
// 批量创建区域仓
|
||||||
|
func TestCreateWarehouse(t *testing.T) {
|
||||||
|
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||||
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||||
|
|
||||||
|
data, err := a.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{
|
||||||
|
OutWarehouseList: []warehouse_createBatch_request.OutWarehouseListItem{
|
||||||
|
{
|
||||||
|
OutWarehouseId: "666668",
|
||||||
|
Name: "V派区域仓",
|
||||||
|
Intro: "VV派区域仓,仓库id为京西门店id",
|
||||||
|
AddressDetail: "四川省成都市金牛区万科加州湾V派",
|
||||||
|
WarehouseLocation: &warehouse_createBatch_request.WarehouseLocation{
|
||||||
|
AddressId1: 51,
|
||||||
|
AddressId2: 510100,
|
||||||
|
AddressId3: 510106,
|
||||||
|
AddressId4: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}})
|
||||||
|
fmt.Println(data)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 仓库绑定门店
|
||||||
|
func TestBindWarehouseToStore(t *testing.T) {
|
||||||
|
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||||
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||||
|
|
||||||
|
data, err := a.StoreBindWarehouse(&warehouse_bindStore_request.WarehouseBindStoreParam{
|
||||||
|
StoreIds: []int64{65312663},
|
||||||
|
OutWarehouseId: "668510",
|
||||||
|
})
|
||||||
|
fmt.Println(data)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 仓库解绑门店
|
||||||
|
func TestUnBind(t *testing.T) {
|
||||||
|
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||||
|
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||||
|
a.WarehouseUnbindStore([]int64{63114504}, "666667")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user