fix(system/log): 修复邮箱登录,手机号登录对应日志没有记录操作人问题

This commit is contained in:
Guaning
2025-01-14 05:39:57 +00:00
committed by Charles7c
parent 0fab8e4a84
commit aab3931f30

View File

@@ -29,8 +29,7 @@ import lombok.RequiredArgsConstructor;
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;
@@ -154,6 +153,16 @@ public class LogDaoLocalImpl implements LogDao {
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 信息