mirror of https://github.com/ouqiang/gocron
增加session目录
parent
e46a138ac5
commit
4c645c311e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue