gormv2升级 第一阶段
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"gin-vue-admin/model/request"
|
||||
"gin-vue-admin/utils"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// @title Register
|
||||
@@ -19,7 +20,7 @@ import (
|
||||
func Register(u model.SysUser) (err error, userInter model.SysUser) {
|
||||
var user model.SysUser
|
||||
// 判断用户名是否注册
|
||||
notRegister := global.GVA_DB.Where("username = ?", u.Username).First(&user).RecordNotFound()
|
||||
notRegister := errors.Is(global.GVA_DB.Where("username = ?", u.Username).First(&user).Error, gorm.ErrRecordNotFound)
|
||||
// notRegister为false表明读取到了 不能注册
|
||||
if !notRegister {
|
||||
return errors.New("用户名已注册"), userInter
|
||||
@@ -69,7 +70,7 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
|
||||
// @return list interface{}
|
||||
// @return total int
|
||||
|
||||
func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int) {
|
||||
func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB.Model(&model.SysUser{})
|
||||
|
Reference in New Issue
Block a user