Exemplo n.º 1
0
//查询明细信息
func (this *EpisodeController) QueryDetail(id int64) revel.Result {
	episode := new(models.Episode)
	condition := qbs.NewCondition("id = ?", id)
	this.q.Condition(condition).Find(episode)
	user := FindUserById(this.q, episode.Author)
	episode.User = user
	this.RenderArgs["episode"] = episode
	return this.RenderTemplate("article/detailEpisode.html")
}
Exemplo n.º 2
0
//保存
func (this *EpisodeController) Save(episode models.Episode) revel.Result {
	episode.Author, _ = strconv.ParseInt(this.Session["userId"], 10, 0)
	//上传文件
	saveFile(this.Request, "attach", path.Join(revel.BasePath, "attach"))
	fmt.Println(path.Join(revel.BasePath, "attach"))
	if !episode.Save(this.q) {
		this.Flash.Error("保存错误")
	}
	return this.Redirect(routes.EpisodeController.QueryDetail(episode.Id))
}