예제 #1
0
파일: topic.go 프로젝트: cloudcache/ohlala
/**
 * 获取用户信息
 * 用于浮动层
 */
func actionPopupBoxInfo(ctx *goku.HttpContext) goku.ActionResulter {

	topicName := ctx.Get("t")
	topic, _ := models.Topic_GetByName(topicName)

	if topic != nil {
		return ctx.RenderPartial("pop-info", models.Topic_ToVTopic(topic, ctx))
	}
	return ctx.Html("")
}
예제 #2
0
파일: topic.go 프로젝트: cloudcache/ohlala
	Get("index", func(ctx *goku.HttpContext) goku.ActionResulter {

		topics, _ := models.Topic_GetTops(1, 30)
		ctx.ViewData["TopTab"] = "topic"
		return ctx.View(models.Topic_ToVTopics(topics, ctx))

	}).

	/**
	 * 查看话题信息页
	 */
	Get("show", func(ctx *goku.HttpContext) goku.ActionResulter {

		ctx.ViewData["TopTab"] = "topic"
		topicName, _ := ctx.RouteData.Params["name"]
		topic, _ := models.Topic_GetByName(topicName)

		if topic == nil {
			ctx.ViewData["errorMsg"] = "话题不存在"
			return ctx.Render("error", nil)
		}

		sort := ctx.Get("o") //排序方式
		t := ctx.Get("t")    //时间范围

		ctx.ViewData["Order"] = golink.ORDER_TYPE_HOT
		if _, ok := golink.ORDER_TYPE_MAP[sort]; ok {
			ctx.ViewData["Order"] = sort
		}

		page, pagesize := utils.PagerParams(ctx.Request)