func (c Admin) EditCategoryPost(id int64, category models.Category) revel.Result { category.Id = id category.Validate(c.Validation) if c.Validation.HasErrors() { c.Validation.Keep() c.FlashParams() return c.Redirect(routes.Admin.EditCategory(id)) } aff, _ := engine.Id(id).Update(&category) if aff > 0 { c.Flash.Success("编辑分类成功") cache.Flush() } else { c.Flash.Error("编辑分类失败") return c.Redirect(routes.Admin.EditCategory(id)) } return c.Redirect(routes.Admin.ListCategory()) }