예제 #1
0
func (c *IndexController) Index() {
	pagination := c.NewPagination()
	userId := c.CurrentUserId()
	services.AllArticles(0, pagination)
	services.SetLikeSign(pagination, userId)
	categories, _ := services.UserCategories(0)
	//推荐博客
	likeBlogs := services.TopLikeUsers()
	c.Data["likeBlogs"] = likeBlogs
	//精华文章
	likeArticles := services.TopLikeArticles()
	c.Data["likeArticles"] = likeArticles

	c.Data["categories"] = categories
	c.Data["pagination"] = pagination
	c.Data["user"] = c.CurrentUser()
	c.TplName = "index.html"
}
예제 #2
0
func (c *BaseController) SetCategories(userId int64) {
	categories, _ := services.UserCategories(userId)
	c.Data["categories"] = categories
}