示例#1
0
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")
}
示例#2
0
func (this *ArticleController) Edit() {
	id, err := this.GetInt("id")
	if err != nil {
		this.Ctx.WriteString("get param id fail")
		return
	}

	b := blog.OneById(int64(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"
}
示例#3
0
func (this *MainController) Get() {
	this.Data["Catalogs"] = catalog.All()
	this.Data["PageTitle"] = "首页"
	this.Layout = "layout/default.html"
	this.TplNames = "index.html"
}
示例#4
0
func (this *ApiController) Health() {
	fmt.Println(catalog.All()[0])
	this.Ctx.WriteString("ok")
}