Пример #1
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")
}
Пример #2
0
func (this *AddController) Post() {
	//数据处理
	this.Ctx.Request.ParseForm()
	pkgname := this.Ctx.Request.Form.Get("pkgname")
	content := this.Ctx.Request.Form.Get("content")
	beego.Info(this.Ctx.Request.Form)
	pk := models.GetCruPkg(pkgname)
	if pk.Id == 0 {
		var pp models.PkgEntity
		pp.Pid = 0
		pp.Pathname = pkgname
		pp.Intro = pkgname
		models.InsertPkg(pp)
		pk = models.GetCruPkg(pkgname)
	}
	var at models.Article
	at.Pkgid = pk.Id
	at.Content = content
	models.InsertArticle(at)
	this.Ctx.Redirect(302, "/admin/index")
}