添加jdapi.UpdateStoreFreightConfigNew

This commit is contained in:
gazebo
2019-10-14 14:31:45 +08:00
parent 0008ac1c78
commit 8b6fc21c28
2 changed files with 58 additions and 0 deletions

View File

@@ -42,6 +42,12 @@ const (
CoordinateTypeTencent = 4 // 腾讯
)
const (
FreightFreeTypeAll = 0 // 全免
FreightFreeTypeBase = 1 // 免基础运费
FreightFreeTypePartBase = 2 // 免部分基础运费
)
type CreateShopResult struct {
DeliveryRangeType int `json:"deliveryRangeType"`
CoordinatePoints string `json:"coordinatePoints"`
@@ -216,6 +222,36 @@ type StoreDeliveryRange struct {
Yn int8 `json:"yn"`
}
type FreeFreightTime struct {
FreeBeginTime string `json:"freeBeginTime,omitempty"`
FreeEndTime string `json:"freeEndTime,omitempty"`
}
type FreeFreightInfo struct {
FullFreeMoney int64 `json:"fullFreeMoney,omitempty"`
FreeType int `json:"freeType"`
FreeMoney int64 `json:"freeMoney,omitempty"`
OutActivityID string `json:"outActivityId,omitempty"`
FreeFreightTimes []*FreeFreightTime `json:"freeFreightTimes,omitempty"`
}
type UpdateStoreFreightParam struct {
UserPin string `json:"userPin"`
OpenDistanceFreight bool `json:"openDistanceFreight"`
IsFullFree bool `json:"isFullFree"`
StationNo string `json:"stationNo,omitempty"`
MerchantStationNo string `json:"merchantStationNo,omitempty"`
StartCharge int64 `json:"startCharge,omitempty"`
SelfDeliveryFreightMoney int64 `json:"selfDeliveryFreightMoney,omitempty"`
StartBeginTime string `json:"startBeginTime,omitempty"`
StartEndTime string `json:"startEndTime,omitempty"`
DistanceFreightThreshold int `json:"distanceFreightThreshold,omitempty"`
DistanceUnit int `json:"distanceUnit,omitempty"`
DistanceFreight int64 `json:"distanceFreight,omitempty"`
FreeFreightInfoList []*FreeFreightInfo `json:"freeFreightInfoList,omitempty"`
}
func (a *API) GetAllCities() (cities []*CityInfo, err error) {
result, err := a.AccessAPINoPage("address/allcities", nil, nil, nil, genNoPageResultParser("code", "msg", "result", "0"))
if err == nil {
@@ -389,3 +425,11 @@ func interface2CreateShopResult(data interface{}) (retVal *CreateShopResult) {
}
return retVal
}
// 根据门店编码修改运费起送价、满免以及商家自送运费接口
// https://openo2o.jddj.com/staticnew/widgets/resources.html?groupid=194&apiid=997977a13c62449ba15f3db3b4aec932
func (a *API) UpdateStoreFreightConfigNew(upateParam *UpdateStoreFreightParam) (err error) {
jdParams := utils.Struct2MapByJson(upateParam)
_, err = a.AccessAPINoPage("freight/updateStoreFreightConfigNew", jdParams, nil, nil, genNoPageResultParser("code", "detail", "", "0"))
return err
}

View File

@@ -137,3 +137,17 @@ func TestDisableAutoOrder4AllStores(t *testing.T) {
break
}
}
func TestUpdateStoreFreightConfigNew(t *testing.T) {
err := api.UpdateStoreFreightConfigNew(&UpdateStoreFreightParam{
UserPin: "test",
MerchantStationNo: "2",
OpenDistanceFreight: true,
IsFullFree: true,
StartCharge: 1890,
})
if err != nil {
t.Fatal(err)
}
}