github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/routers/root/RDashboard.go (about)

     1  package root
     2  
     3  import (
     4  	"github.com/insionng/makross"
     5  	"github.com/insionng/yougam/helper"
     6  	"github.com/insionng/yougam/models"
     7  )
     8  
     9  func GetRDashboardHandler(self *makross.Context) error {
    10  
    11  	self.Set("catpage", "RDashboardHandler")
    12  	TplNames := "root/dashboard"
    13  
    14  	if tps, err := models.GetTopics(0, 3, "id"); tps != nil && err == nil {
    15  		self.Set("tps", *tps)
    16  	}
    17  
    18  	if rpys := models.GetReplysByTid(0, 0, 0, 10, "id"); rpys != nil {
    19  		self.Set("replys", rpys)
    20  	}
    21  
    22  	if tps := models.GetTopicsByPid(0, 0, 10, 0, "hotness"); tps != nil {
    23  		self.Set("topics_sidebar_10", *tps)
    24  	}
    25  
    26  	//本周趋势
    27  	if tps := models.GetTopicsByPidSinceCreated(0, 0, 10, 0, "hotup", helper.ThisWeek()); len(*tps) > 0 {
    28  		self.Set("topics_thisWeek_10", *tps)
    29  	}
    30  	return self.Render(TplNames)
    31  }