From 8b6fc21c28254ccfb9dd014601e6976625e4fd75 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 14 Oct 2019 14:31:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0jdapi.UpdateStoreFreightConfi?= =?UTF-8?q?gNew?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdapi/store.go | 44 +++++++++++++++++++++++++++++++++ platformapi/jdapi/store_test.go | 14 +++++++++++ 2 files changed, 58 insertions(+) diff --git a/platformapi/jdapi/store.go b/platformapi/jdapi/store.go index e5811e31..08bab25b 100644 --- a/platformapi/jdapi/store.go +++ b/platformapi/jdapi/store.go @@ -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 +} diff --git a/platformapi/jdapi/store_test.go b/platformapi/jdapi/store_test.go index 47f5d5f6..e15d614d 100644 --- a/platformapi/jdapi/store_test.go +++ b/platformapi/jdapi/store_test.go @@ -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) + } +}