三方运单计价各管各,不在以美团为基准,创建运单只有一个限制条件,最高运费:maxDeliveryFee

优化美团运费计算,两点距离用高德API实际计算行走距离
This commit is contained in:
gazebo
2019-09-26 15:47:18 +08:00
parent 860040e6f1
commit 78930d9c1a
12 changed files with 168 additions and 125 deletions

View File

@@ -205,3 +205,57 @@ func TestGetShortNameFromURL(t *testing.T) {
}
}
}
func TestCalcStageValue(t *testing.T) {
type tTestType struct {
DesiredValue float64
Params1 [][]float64
Params2 float64
}
priceStage := [][]float64{
[]float64{
7,
300,
},
[]float64{
5,
200,
},
[]float64{
3,
100,
},
}
for _, v := range []*tTestType{
&tTestType{
DesiredValue: 0,
Params1: priceStage,
Params2: 3,
},
&tTestType{
DesiredValue: 0,
Params1: priceStage,
Params2: 0,
},
&tTestType{
DesiredValue: 200,
Params1: priceStage,
Params2: 5,
},
&tTestType{
DesiredValue: 400,
Params1: priceStage,
Params2: 5.01,
},
&tTestType{
DesiredValue: 600,
Params1: priceStage,
Params2: 7,
},
} {
value := CalcStageValue(v.Params1, v.Params2)
if value != v.DesiredValue {
t.Errorf("DesiredValue:%f, value:%f", v.DesiredValue, value)
}
}
}