//用户列表 func (this *UserController) List() { var page int64 var pagesize int64 = 10 var list []*models.User var user models.User if page, _ = this.GetInt64("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["list"] = list this.Data["pagebar"] = models.NewPager(page, count, pagesize, "/admin/user/list?page=%d").ToString() this.display() }