路由规则找不到的时候提示用户

This commit is contained in:
刘祥超
2023-07-17 15:30:19 +08:00
parent 2d4378423b
commit a99bcdc437
6 changed files with 36 additions and 7 deletions

View File

@@ -23,7 +23,12 @@ func (this *IndexAction) Init() {
func (this *IndexAction) RunGet(params struct {
LocationId int64
}) {
locationConfig := this.Data.Get("locationConfig").(*serverconfigs.HTTPLocationConfig)
var location = this.Data.Get("locationConfig")
if location == nil {
this.NotFound("location", params.LocationId)
return
}
var locationConfig = location.(*serverconfigs.HTTPLocationConfig)
this.Data["patternTypes"] = serverconfigs.AllLocationPatternTypes()