增加jwt主动失效功能(next:多点登录限制

This commit is contained in:
pixel
2019-12-28 18:32:47 +08:00
parent 22820d9983
commit 7e3870490f
11 changed files with 114 additions and 10 deletions

View File

@@ -29,9 +29,9 @@ type SysUser struct {
func (u *SysUser) Regist() (err error, userInter *SysUser) {
var user SysUser
//判断用户名是否注册
findErr := qmsql.DEFAULTDB.Where("username = ?", u.Username).First(&user).Error
//err为nil表明读取到了 不能注册
if findErr == nil {
notResigt := qmsql.DEFAULTDB.Where("username = ?", u.Username).First(&user).RecordNotFound()
//notResigt为false表明读取到了 不能注册
if !notResigt {
return errors.New("用户名已注册"), nil
} else {
// 否则 附加uuid 密码md5简单加密 注册