增加session目录

pull/21/merge
ouqiang 2017-04-26 09:02:38 +08:00
parent e46a138ac5
commit 4c645c311e
2 changed files with 1 additions and 15 deletions

0
data/sessions/.gitkeep Normal file
View File

View File

@ -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)