Refactor
This commit is contained in:
parent
da0187b74d
commit
5a5f81c0fb
3 changed files with 32 additions and 40 deletions
|
|
@ -106,15 +106,7 @@ func getStations(code string) (stations []IDFMStation, err error) {
|
|||
func declareStationsRoutes(router *gin.RouterGroup) {
|
||||
router.GET("/stations/:type/:code", func(c *gin.Context) {
|
||||
t := convertLineType(string(c.Param("type")))
|
||||
code := string(c.Param("code"))
|
||||
|
||||
if !strings.HasPrefix(code, "line:IDFM:") {
|
||||
if len(code) != 6 || !strings.HasPrefix(code, "C") {
|
||||
code = searchLine(t, code)
|
||||
}
|
||||
|
||||
code = "line:IDFM:" + code
|
||||
}
|
||||
code := convertCode(t, string(c.Param("code")))
|
||||
|
||||
stations, err := getStations(code)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue