//用户列表 func (this *UserController) List() { var page int var pagesize int = 10 var list []*models.User var user models.User if page, _ = this.GetInt("page"); page < 1 { page = 1 } offset := (page - 1) * pagesize count, _ := user.Query().Count() if count > 0 { user.Query().OrderBy("-id").Limit(pagesize, offset).All(&list) } this.Data["count"] = count this.Data["list"] = list //this.Data["pagebar"] = util.NewPager(page, int(count), pagesize, "/admin/user/list", true).ToString() this.display() }