1
This commit is contained in:
@@ -15,7 +15,7 @@ func TestCancelOrder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderGet(t *testing.T) {
|
func TestOrderGet(t *testing.T) {
|
||||||
result, err := api.OrderGet2("4013460139778872942")
|
result, err := api.OrderGet("4074700081425894134")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} 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(而不是空,0),1538103149不是特殊值,只是一个任意之前的时间,这样写可以处理
|
||||||
|
return utils.DefaultTimeValue
|
||||||
|
}
|
||||||
|
return utils.Timestamp2Time(timeStamp)
|
||||||
|
}
|
||||||
|
|
||||||
func TestOrderAgreePartRefund(t *testing.T) {
|
func TestOrderAgreePartRefund(t *testing.T) {
|
||||||
param := &RefundOrderExamine{
|
param := &RefundOrderExamine{
|
||||||
ReverseOrderId: "",
|
ReverseOrderId: "",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,13 +71,15 @@ func (a *API) TencentCyclingPlanning(param *TencentCyclingPlanningReq) (distance
|
|||||||
for i := 2; i < len(v.Polyline); i++ {
|
for i := 2; i < len(v.Polyline); i++ {
|
||||||
point1 := utils.Str2Float64(pointList[i-2])
|
point1 := utils.Str2Float64(pointList[i-2])
|
||||||
point2, _ := v.Polyline[i].Float64()
|
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 {
|
for i := 0; i < len(pointList); i += 2 {
|
||||||
coordinatePoint = append(coordinatePoint, fmt.Sprintf("%s,%s", pointList[i+1], pointList[i]))
|
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
|
return distance, duration, coordinatePoint, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ func TestCoordinateChange(t *testing.T) {
|
|||||||
func TestTencentCyclingPlanning(t *testing.T) {
|
func TestTencentCyclingPlanning(t *testing.T) {
|
||||||
distance, duration, point, err := tencent.TencentCyclingPlanning(&TencentCyclingPlanningReq{
|
distance, duration, point, err := tencent.TencentCyclingPlanning(&TencentCyclingPlanningReq{
|
||||||
Key: tencent.key,
|
Key: tencent.key,
|
||||||
From: "30.637486,103.919896",
|
From: "30.610506,104.065132",
|
||||||
To: "30.604708,103.913647",
|
To: "30.581323,104.048340",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user