Refactoring codes for more tg message types
This commit is contained in:
@@ -2,6 +2,7 @@ package bus
|
||||
|
||||
import (
|
||||
i18n "github.com/tgckpg/golifehk/i18n"
|
||||
query "github.com/tgckpg/golifehk/query"
|
||||
)
|
||||
|
||||
type BusStop struct {
|
||||
@@ -10,8 +11,6 @@ type BusStop struct {
|
||||
Direction string
|
||||
StationSeq int
|
||||
StationId string
|
||||
Latitude float64
|
||||
Longtitude float64
|
||||
Name_zh string
|
||||
Name_en string
|
||||
|
||||
@@ -22,6 +21,7 @@ type BusStop struct {
|
||||
AltRoutes *map[string]*BusStop
|
||||
|
||||
i18n.Generics
|
||||
query.GeoLocation
|
||||
}
|
||||
|
||||
func (this *BusStop) PrevStop() *BusStop {
|
||||
@@ -52,6 +52,14 @@ func (this *BusStop) Reload() {
|
||||
this.SearchData = &searchData
|
||||
}
|
||||
|
||||
func (this BusStop) Register(registers map[string]struct{}) bool {
|
||||
if _, ok := registers[this.StationId]; ok {
|
||||
return false
|
||||
}
|
||||
registers[this.StationId] = struct{}{}
|
||||
return true
|
||||
}
|
||||
|
||||
type ByRoute []*BusStop
|
||||
|
||||
func (a ByRoute) Len() int { return len(a) }
|
||||
|
||||
Reference in New Issue
Block a user