-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtrack_test.go
47 lines (43 loc) · 1.16 KB
/
track_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package yingyan_test
import (
"fmt"
"testing"
"time"
"github.com/cnjack/yingyan.sdk"
)
func TestS_AddPoint(t *testing.T) {
client := yingyan.NewClient("do0znBH8Du2YflrDtZ6osFGVXOEG3osi", "fOBSnqpZyppQ2ImXP7HfqFeeY17MouzZ", 135928)
body, err := client.AddPoint(&yingyan.PointData{
EntityName: "run_1",
Latitude: 39.848434,
Longitude: 116.492943,
CoordType: yingyan.BaiDuCoordType,
})
if err != nil {
t.Error("EntityAdd err :", err.Error())
}
fmt.Println(body)
}
func TestS_AddPoints(t *testing.T) {
client := yingyan.NewClient("do0znBH8Du2YflrDtZ6osFGVXOEG3osi", "fOBSnqpZyppQ2ImXP7HfqFeeY17MouzZ", 135928)
params := []*yingyan.PointData{}
params = append(params, &yingyan.PointData{
EntityName: "run_1",
Latitude: 39.845434,
LocTime: time.Now().Unix(),
Longitude: 116.442943,
CoordType: yingyan.BaiDuCoordType,
})
params = append(params, &yingyan.PointData{
EntityName: "run_1",
Latitude: 39.845534,
LocTime: time.Now().Unix() - 60,
Longitude: 116.495343,
CoordType: yingyan.BaiDuCoordType,
})
body, err := client.AddPoints(params)
if err != nil {
t.Error("EntityAdd err :", err.Error())
}
fmt.Println(body)
}