This commit is contained in:
邹宗楠
2024-07-31 15:03:46 +08:00
parent 8ecfd93781
commit e27ea9f69a
3 changed files with 24 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ func TestCancelOrder(t *testing.T) {
}
func TestOrderGet(t *testing.T) {
result, err := api.OrderGet2("4013460139778872942")
result, err := api.OrderGet("4074700081425894134")
if err != nil {
t.Fatal(err)
} else {
@@ -23,6 +23,23 @@ func TestOrderGet(t *testing.T) {
}
}
func TestNamegetTimeFromInterface1(t *testing.T) {
fmt.Println(getTimeFromInterface1(1722394671))
fmt.Println(getTimeFromInterface1(1722394671) == utils.ZeroTimeValue)
}
func getTimeFromInterface1(timeValue interface{}) time.Time {
var timeStamp int64
if timeStr, ok := timeValue.(string); ok {
timeStamp = utils.Str2Int64WithDefault(timeStr, 0)
} else {
timeStamp = utils.Interface2Int64WithDefault(timeValue, 0)
}
if timeStamp < 1538103149 { // 立即达订单给的是1而不是空01538103149不是特殊值只是一个任意之前的时间这样写可以处理
return utils.DefaultTimeValue
}
return utils.Timestamp2Time(timeStamp)
}
func TestOrderAgreePartRefund(t *testing.T) {
param := &RefundOrderExamine{
ReverseOrderId: "",

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
)
@@ -72,13 +71,15 @@ func (a *API) TencentCyclingPlanning(param *TencentCyclingPlanningReq) (distance
for i := 2; i < len(v.Polyline); i++ {
point1 := utils.Str2Float64(pointList[i-2])
point2, _ := v.Polyline[i].Float64()
pointList = append(pointList, fmt.Sprintf("%.6f", point1+point2/float64(1000000)))
point3 := point1 + point2/float64(1000000)
point4 := fmt.Sprintf("%.13f", point3)
pointList = append(pointList, point4)
}
for i := 0; i < len(pointList); i += 2 {
coordinatePoint = append(coordinatePoint, fmt.Sprintf("%s,%s", pointList[i+1], pointList[i]))
}
globals.SugarLogger.Debugf("调换后 : %s", utils.Format4Output(coordinatePoint, false))
return distance, duration, coordinatePoint, nil
}

View File

@@ -38,8 +38,8 @@ func TestCoordinateChange(t *testing.T) {
func TestTencentCyclingPlanning(t *testing.T) {
distance, duration, point, err := tencent.TencentCyclingPlanning(&TencentCyclingPlanningReq{
Key: tencent.key,
From: "30.637486,103.919896",
To: "30.604708,103.913647",
From: "30.610506,104.065132",
To: "30.581323,104.048340",
})
if err != nil {
t.Log(err)