Esempio n. 1
0
func admin_topics(ctx *goku.HttpContext) goku.ActionResulter {
	page, pagesize := utils.PagerParams(ctx.Request)
	topics, total, err := models.Topic_GetByPage(page, pagesize, "")
	if err != nil {
		ctx.ViewData["errorMsg"] = err.Error()
		return ctx.Render("error", nil)
	}
	ctx.ViewData["TopicList"] = topics
	ctx.ViewData["TopicCount"] = total
	ctx.ViewData["Page"] = page
	ctx.ViewData["Pagesize"] = pagesize
	ctx.ViewData["TabName"] = "topics"
	return ctx.View(nil)
}
Esempio n. 2
0
// 新用户引导
func home_guideForNew(ctx *goku.HttpContext) goku.ActionResulter {
	pagesize := 30
	users, totalUser, err := models.User_GetList(1, pagesize, "link_count desc")
	if err != nil {
		ctx.ViewData["errorMsg"] = err.Error()
		return ctx.Render("error", nil)
	}
	topics, totalTopic, err := models.Topic_GetByPage(1, pagesize, "link_count desc")
	if err != nil {
		ctx.ViewData["errorMsg"] = err.Error()
		return ctx.Render("error", nil)
	}
	ctx.ViewData["Users"] = models.User_ToVUsers(users, ctx)
	ctx.ViewData["TotalUser"] = totalUser
	ctx.ViewData["Topics"] = models.Topic_ToVTopics(topics, ctx)
	ctx.ViewData["TotalTopics"] = totalTopic
	return ctx.Render("guide", nil)
}