func (c *ArticleController) Articles() { pagination := c.NewPagination() userId := c.CurrentUserId() services.AllArticles(userId, pagination) c.Data["pagination"] = pagination c.TplName = "index.html" }
func (c *UserController) UserHome() { pagination := c.NewPagination() userId := c.CurrentUserId() services.AllArticles(userId, pagination) services.SetLikeSign(pagination, userId) c.Data["pagination"] = pagination c.Data["user"] = c.CurrentUser() c.TplName = "user_home.html" c.SetCategories(userId) }
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" }