|
@ -2,6 +2,7 @@ package system |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
"fmt" |
|
|
|
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request" |
|
@ -39,6 +40,10 @@ func (userService *UserService) Register(u system.SysUser) (err error, userInter |
|
|
//@return: err error, userInter *model.SysUser
|
|
|
//@return: err error, userInter *model.SysUser
|
|
|
|
|
|
|
|
|
func (userService *UserService) Login(u *system.SysUser) (err error, userInter *system.SysUser) { |
|
|
func (userService *UserService) Login(u *system.SysUser) (err error, userInter *system.SysUser) { |
|
|
|
|
|
if nil == global.GVA_DB { |
|
|
|
|
|
return fmt.Errorf("db not init"), nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var user system.SysUser |
|
|
var user system.SysUser |
|
|
u.Password = utils.MD5V([]byte(u.Password)) |
|
|
u.Password = utils.MD5V([]byte(u.Password)) |
|
|
err = global.GVA_DB.Where("username = ? AND password = ?", u.Username, u.Password).Preload("Authorities").Preload("Authority").First(&user).Error |
|
|
err = global.GVA_DB.Where("username = ? AND password = ?", u.Username, u.Password).Preload("Authorities").Preload("Authority").First(&user).Error |
|
|