Refactoring codes for more tg message types

This commit is contained in:
2026-03-07 22:16:14 +08:00
parent a396a381b5
commit 912f9fd0ad
26 changed files with 771 additions and 472 deletions

View File

@@ -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) }