修改文件目录
This commit is contained in:
1 parent
41b06c806a
commit
01ea376015
109 files changed
+180
-172
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/tools"
|
||||
)
|
||||
|
||||
type Login struct {
|
||||
Username string `form:"UserName" json:"username" binding:"required"`
|
||||
Password string `form:"Password" json:"password" binding:"required"`
|
||||
Code string `form:"Code" json:"code" binding:"required"`
|
||||
UUID string `form:"UUID" json:"uuid" binding:"required"`
|
||||
}
|
||||
|
||||
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 {
|
||||
return
|
||||
}
|
||||
_, e = tools.CompareHashAndPassword(user.Password, u.Password)
|
||||
if e != nil {
|
||||
return
|
||||
}
|
||||
e = orm.Eloquent.Table("sys_role").Where("role_id = ? ", user.RoleId).First(&role).Error
|
||||
if e != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in new issue
Block a user