예제 #1
0
func (self *NewTopicHandler) Post() {
	nid, _ := self.GetInt("nodeid")
	cid := models.GetNode(nid).Pid
	uid, _ := self.GetSession("userid").(int64)
	tid_title := self.GetString("title")
	tid_content := self.GetString("content")
	if tid_title != "" && tid_content != "" {
		models.AddTopic(self.GetString("title"), self.GetString("content"), cid, nid, uid)
		self.Ctx.Redirect(302, "/node/"+self.GetString("nodeid"))
	} else {
		self.Ctx.Redirect(302, "/")
	}
}
예제 #2
0
func (self *NewTopicHandler) Post() {
	nid, _ := self.GetInt("nodeid")
	cid := models.GetNode(nid).Pid
	uid, _ := self.GetSession("userid").(int64)
	author, _ := self.GetSession("username").(string)

	fmt.Println("=============================")
	fmt.Println(self.GetSession("userid"))
	fmt.Println(uid)

	tid_title := self.GetString("title")
	tid_content := self.GetString("content")

	if tid_title != "" && tid_content != "" {
		models.AddTopic(tid_title, tid_content, cid, nid, uid, author)
		self.Ctx.Redirect(302, "/node/"+self.GetString("nodeid"))
	} else {
		self.Ctx.Redirect(302, "/")
	}
}