Пример #1
0
func ac_articleshow(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	article := Article_Get(bson.ObjectIdHex(vars["id"]))
	tags := TagidToname(article.Tags)
	comment := Article_Getcomment(bson.ObjectIdHex(vars["id"]))
	IndexTemplate(w, r,
		map[string]interface{}{"article": article, "tags": tags, "comment": comment},
		"template/article/articleshow.html")

}
Пример #2
0
func ac_tshow(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	var post Group_posts
	err := Db.C("go_Group_posts").Find(bson.M{"_id": bson.ObjectIdHex(vars["tid"])}).One(&post)
	CheckErr(err)
	var comm []Group_posts_comment
	Db.C("go_Group_posts_comment").Find(bson.M{"postid": post.Id_}).All(&comm)
	Db.C("go_Group_posts").Update(bson.M{"_id": post.Id_}, bson.M{"$inc": bson.M{"count_click": 1}})
	IndexTemplate(w, r, map[string]interface{}{"post": post, "comm": comm}, "template/group/tlist.html")
}
Пример #3
0
func ac_group(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	var group Group
	err := Db.C("go_Group").Find(bson.M{"_id": bson.ObjectIdHex(vars["group"])}).One(&group)
	CheckErr(err)
	var posts []Group_posts
	Db.C("go_Group_posts").Find(bson.M{"groupid": bson.ObjectIdHex(vars["group"])}).
		Sort("-lasttime").All(&posts)
	IndexTemplate(w, r, map[string]interface{}{"group": group, "posts": posts,
		"user": User_curuser(w, r)}, "template/group/group.html")
}