func (this *Article) Prepare() { this.BaseController.Prepare() //找不到该文章 if this.art = article.GetArticleById(bson.ObjectIdHex(this.Ctx.Input.Param(":id")), true); this.art == nil { this.Abort("404") } }
func (this *ModifyArticle) Prepare() { this.AuthController.Prepare() id := bson.ObjectIdHex(this.Ctx.Input.Param(":id")) this.art = article.GetArticleById(id) if this.art == nil { this.Abort("404") //找不到对应的文档 } }