Exemplo n.º 1
0
//回复
func ac_commentpost(w http.ResponseWriter, r *http.Request) {
	userid := User_curuserid(w, r)
	if userid == "" {
		ExitMsg(w, "请登录")
	}
	text := ubb2html.Ubb2html(r.FormValue("text"))
	p := &Group_posts_comment{Id_: bson.NewObjectId(), Postid: bson.ObjectIdHex(r.FormValue("tid")),
		Userid: bson.ObjectIdHex(userid), Content: template.HTML(text),
		Referid: bson.ObjectIdHex(r.FormValue("rid"))}
	AddComment(p)
	http.Redirect(w, r, "/group/p/"+r.FormValue("tid"), http.StatusFound)
}
Exemplo n.º 2
0
func ac_articlecomment(w http.ResponseWriter, r *http.Request) {
	if r.Method == "POST" {
		id := User_curuserid(w, r)
		if id == "" {
			ExitMsg(w, "请先登录")
			return
		}
		ac := Article_comment{Id_: bson.NewObjectId(),
			Articleid: bson.ObjectIdHex(r.FormValue("articleid")),
			Userid:    bson.ObjectIdHex(id),
			Content:   template.HTML(ubb2html.Ubb2html(r.FormValue("text"))),
		}
		err := Db.C("go_Article_comment").Insert(&ac)
		CheckErr(err)
		ExitMsg(w, "评论成功")
	}
}