Skip to content

Commit

Permalink
fix(system/log): 修复邮箱登录,手机号登录对应日志没有记录操作人问题
Browse files Browse the repository at this point in the history
  • Loading branch information
iguaning authored and Charles7c committed Jan 14, 2025
1 parent 0fab8e4 commit aab3931
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import org.springframework.http.HttpHeaders;
import org.springframework.scheduling.annotation.Async;
import top.continew.admin.auth.enums.AuthTypeEnum;
import top.continew.admin.auth.model.req.AccountLoginReq;
import top.continew.admin.auth.model.req.LoginReq;
import top.continew.admin.auth.model.req.*;
import top.continew.admin.common.constant.SysConstants;
import top.continew.admin.system.enums.LogStatusEnum;
import top.continew.admin.system.mapper.LogMapper;
Expand Down Expand Up @@ -154,6 +153,16 @@ private void setCreateUser(LogDO logDO, LogRequest logRequest, LogResponse logRe
logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByUsername(authReq.getUsername())
.getId()));
return;
} else if (requestBody.contains(AuthTypeEnum.EMAIL.getValue())) {
EmailLoginReq authReq = JSONUtil.toBean(requestBody, EmailLoginReq.class);
logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByEmail(authReq.getEmail())
.getId()));
return;
} else if (requestBody.contains(AuthTypeEnum.PHONE.getValue())) {
PhoneLoginReq authReq = JSONUtil.toBean(requestBody, PhoneLoginReq.class);
logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByPhone(authReq.getPhone())
.getId()));
return;
}
}
// 解析 Token 信息
Expand Down

0 comments on commit aab3931

Please sign in to comment.