func (this *ArticleController) Add() { this.Data["Catalogs"] = catalog.All() this.Data["IsPost"] = true this.Layout = "layout/admin.html" this.TplNames = "article/add.html" this.JsStorage("deleteKey", "post/new") }
func (this *ArticleController) Edit() { id, err := this.GetInt("id") if err != nil { this.Ctx.WriteString("get param id fail") return } b := blog.OneById(id) if b == nil { this.Ctx.WriteString("no such article") return } this.Data["Content"] = blog.ReadBlogContent(b).Content this.Data["Blog"] = b this.Data["Catalogs"] = catalog.All() this.Layout = "layout/admin.html" this.TplNames = "article/edit.html" }
func (this *MainController) Get() { this.Data["Catalogs"] = catalog.All() this.Data["PageTitle"] = "首页" this.Layout = "layout/default.html" this.TplNames = "index.html" }
func (this *ApiController) Health() { fmt.Println(catalog.All()[0]) this.Ctx.WriteString("ok") }