示例#1
0
文件: welcome.go 项目: ruoL/code
//显示后台首页
func (this *WelcomeController) Get() {
	var err error
	this.Data["ArticleCount"], err = models.GetArticleCount([]int{0, 1})
	if err != nil {
		beego.Error(err)
	}
	this.Data["CategoryCount"], err = models.GetCategoryCount()
	if err != nil {
		beego.Error(err)
	}
	this.Data["UserCount"], err = models.GetUserCount()
	if err != nil {
		beego.Error(err)
	}
	this.Data["Title"] = "梵响 - 后台首页"
	this.Layout = "manager/layout.html"
	this.TplNames = "manager/index.html"
}
示例#2
0
文件: category.go 项目: ruoL/code
//显示首页
func (this *CategoryController) Get() {
	//处理分页
	pageSize, err := beego.AppConfig.Int("pagesize")
	if err != nil {
		pageSize = 10
	}
	count, err := models.GetCategoryCount()
	if err != nil {
		this.Abort("404")
	}
	paginator := pagination.NewPaginator(this.Ctx.Request, pageSize, count)
	this.Data["paginator"] = paginator
	//查询数据
	this.Data["Categories"], err = models.GetCategories(paginator.Offset(), pageSize)
	if err != nil {
		this.Abort("404")
	}
	this.Data["Title"] = "管理后台 - 所有分类"
	this.Layout = "manager/layout.html"
	this.TplNames = "manager/category_index.html"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHead"] = "manager/category_index_heade.html"
}