diff --git a/data/sessions/.gitkeep b/data/sessions/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/models/user.go b/models/user.go index 29dac5a..5ae94e2 100644 --- a/models/user.go +++ b/models/user.go @@ -82,9 +82,8 @@ func (user *User) EmailExists(email string) (int64, error) { } func (user *User) List() ([]User, error) { - user.parsePageAndPageSize() list := make([]User, 0) - err := Db.Desc("id").Limit(user.PageSize, user.pageLimitOffset()).Find(&list) + err := Db.Desc("id").Find(&list) return list, err } @@ -93,19 +92,6 @@ func (user *User) Total() (int64, error) { return Db.Count(user) } -func (user *User) parsePageAndPageSize() { - if user.Page <= 0 { - user.Page = Page - } - if user.PageSize >= 0 || user.PageSize > MaxPageSize { - user.PageSize = PageSize - } -} - -func (user *User) pageLimitOffset() int { - return (user.Page - 1) * user.PageSize -} - // 密码加密 func (user *User) encryptPassword(password, salt string) string { return utils.Md5(password + salt)