-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
47 lines (39 loc) · 1.04 KB
/
main.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 main
import (
"github.com/bingbaba/util/logs"
"github.com/xuebing1110/rtbus/api"
)
func main() {
//logger
logs.SetDebug(true)
logger := logs.GetBlogger()
//init
bp, err := api.NewBusPool()
if err != nil {
logger.Error("%v", err)
}
//query lines
busLines := [][3]string{
//[3]string{"北京", "675", "0"},
// [3]string{"北京", "675", "通州李庄-左家庄"},
[3]string{"北京", "675", "左家庄-通州李庄"},
//[3]string{"青岛", "318", "市政府-虎山军体中心"},
[3]string{"青岛", "318", "1"},
}
for _, line := range busLines {
logger.Info("Query %s %s %s ...", line[0], line[1], line[2])
//线路-各公交站
bdi, err := bp.GetBusLineDirInfo(line[0], line[1], line[2])
if err != nil {
logger.Error("%v", err)
}
logger.Info("%s", api.ToJsonString(bdi))
//线路-到站情况
rbuses, err := bp.GetRT(line[0], line[1], line[2])
if err != nil {
logger.Error("%v", err)
}
logger.Info("%s", api.ToJsonString(rbuses))
logger.Info("Query %s %s %s over!", line[0], line[1], line[2])
}
}