增加普通用户访问资产时的校验 close #44

This commit is contained in:
dushixiang
2021-01-26 21:54:44 +08:00
parent 4f1bfa6c5a
commit d771ad6ab6
7 changed files with 71 additions and 13 deletions

View File

@ -72,6 +72,17 @@ func UserDeleteEndpoint(c echo.Context) error {
if account.ID == userId {
return Fail(c, -1, "不允许删除自身账户")
}
// 将用户强制下线
loginLogs, err := model.FindAliveLoginLogsByUserId(userId)
if err != nil {
return err
}
if loginLogs != nil && len(loginLogs) > 0 {
for j := range loginLogs {
model.Logout(loginLogs[j].ID)
}
}
// 删除用户
model.DeleteUserById(userId)
}