Fix problems modifying personal information,Upgrade route configuration format

This commit is contained in:
zhangwenjian committed 2020-05-25 21:30:29 +08:00
1 parent e07cb22255
commit c0b8199c36
18 files changed
+355 -244

No files matched your search

-11
View File
@@ -3,8 +3,6 @@ package models
import (
orm "go-admin/database"
"go-admin/tools"
"log"
"strings"
)
type Login struct {
@@ -18,23 +16,14 @@ func (u *Login) GetUser() (user SysUser, role SysRole, e error) {
e = orm.Eloquent.Table("sys_user").Where("username = ? ", u.Username).Find(&user).Error
if e != nil {
if strings.Contains(e.Error(), "record not found") {
tools.HasError(e, "账号或密码错误(代码204)", 500)
}
log.Print(e)
return
}
_, e = tools.CompareHashAndPassword(user.Password, u.Password)
if e != nil {
if strings.Contains(e.Error(), "hashedPassword is not the hash of the given password") {
tools.HasError(e, "账号或密码错误(代码201)", 500)
}
log.Print(e)
return
}
e = orm.Eloquent.Table("sys_role").Where("role_id = ? ", user.RoleId).First(&role).Error
if e != nil {
log.Print(e.Error())
return
}
return