- GetDeliveryRangeByStationNo added.

This commit is contained in:
gazebo
2018-08-30 15:20:53 +08:00
parent 6aed9dc26d
commit 15d7358e90
2 changed files with 19 additions and 5 deletions

View File

@@ -153,6 +153,19 @@ func (a *API) UpdateStoreConfig4Open(stationNo string, isAutoOrder bool) (bool,
return result.(bool), nil
}
// 获取门店配送范围接口
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=8f6d0ac75d734c68bf5bd2a09f376a78
func (a *API) GetDeliveryRangeByStationNo(stationNo string) (map[string]interface{}, error) {
jdParams := map[string]interface{}{
"stationNo": stationNo,
}
result, err := a.AccessAPINoPage("store/getDeliveryRangeByStationNo", jdParams, nil, nil, nil)
if err == nil {
return result.(map[string]interface{}), nil
}
return nil, err
}
// 私有函数
func interface2CreateShopResult(data interface{}) (retVal *CreateShopResult) {
if result, ok := data.(map[string]interface{}); ok {

View File

@@ -55,8 +55,12 @@ func TestUpdateStoreInfo4Open(t *testing.T) {
t.Fatal(err)
}
time.Sleep(2 * time.Second)
result, err = jdapi.GetStoreInfoByStationNo(mustExistStoreID)
newAddress := result["stationAddress"].(string)
if newAddress != testAddress {
t.Fatalf("address not match, newAddress:%s, oldAddress:%s", newAddress, oldAddress)
}
addParams = map[string]interface{}{
"stationAddress": oldAddress,
}
@@ -64,10 +68,7 @@ func TestUpdateStoreInfo4Open(t *testing.T) {
if err != nil {
t.Fatal(err)
}
restoredAddress := result["stationAddress"].(string)
if restoredAddress != oldAddress {
t.Fatalf("address not match, it's:%s", restoredAddress)
}
}
func TestGetCommentByOrderId(t *testing.T) {
testOrderID := int64(819498819000341)