From 4c645c311e4982cf0c686ddd30d2680f41395376 Mon Sep 17 00:00:00 2001 From: ouqiang Date: Wed, 26 Apr 2017 09:02:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0session=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/sessions/.gitkeep | 0 models/user.go | 16 +--------------- 2 files changed, 1 insertion(+), 15 deletions(-) create mode 100644 data/sessions/.gitkeep 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)