Exemple #1
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")
}
Exemple #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")
}