Ejemplo n.º 1
0
func (this *EditController) Get() {
	var at models.Article
	atId, _ := strconv.Atoi(this.Ctx.Params[":id"])
	at = models.GetArticleById(atId)
	pk := models.GetPkgByID(at.Pkgid)
	this.Data["article"] = at
	this.Data["pkg"] = pk
	this.Layout = "admin/layout.html"
	this.TplNames = "admin/edit.tpl"
}
Ejemplo n.º 2
0
func (this *DelController) Get() {
	var at models.Article
	atId, _ := strconv.Atoi(this.Ctx.Params[":id"])
	at = models.GetArticleById(atId)
	models.DeleteArticle(at)
	var pk models.PkgEntity
	pk.Id = at.Pkgid
	models.DeletePkg(pk)
	this.Ctx.Redirect(302, "/admin/index")
}
Ejemplo n.º 3
0
func (this *EditController) Post() {
	//数据处理
	this.Ctx.Request.ParseForm()
	id := this.Ctx.Request.Form.Get("id")
	atid, _ := strconv.Atoi(id)
	at := models.GetArticleById(atid)
	content := this.Ctx.Request.Form.Get("content")
	at.Content = content
	models.InsertArticle(at)
	this.Ctx.Redirect(302, "/admin/index")
}