Commit 933bb188bd904fd55df707dcb2904ae565ec7dbe
Committed by
Gitee
!498 解决解决 Set access token expire time to 0 报错问题和邮件发送用户编号为空问题
Merge pull request !498 from clockdotnet/master_pr
Showing
2 changed files
with
7 additions
and
2 deletions
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTemplateController.java
| ... | ... | @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.system.controller.admin.mail; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.security.core.LoginUser; | |
| 6 | +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; | |
| 5 | 7 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.*; |
| 6 | 8 | import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; |
| 7 | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; |
| ... | ... | @@ -81,7 +83,8 @@ public class MailTemplateController { |
| 81 | 83 | @Operation(summary = "发送短信") |
| 82 | 84 | @PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')") |
| 83 | 85 | public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) { |
| 84 | - return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), null, | |
| 86 | + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); | |
| 87 | + return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), loginUser != null ? loginUser.getId() : null, | |
| 85 | 88 | sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); |
| 86 | 89 | } |
| 87 | 90 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/redis/oauth2/OAuth2AccessTokenRedisDAO.java
| ... | ... | @@ -37,7 +37,9 @@ public class OAuth2AccessTokenRedisDAO { |
| 37 | 37 | // 清理多余字段,避免缓存 |
| 38 | 38 | accessTokenDO.setUpdater(null).setUpdateTime(null).setCreateTime(null).setCreator(null).setDeleted(null); |
| 39 | 39 | long time = LocalDateTimeUtil.between(LocalDateTime.now(), accessTokenDO.getExpiresTime(), ChronoUnit.SECONDS); |
| 40 | - stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(accessTokenDO), time, TimeUnit.SECONDS); | |
| 40 | + if (time > 0) { | |
| 41 | + stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(accessTokenDO), time, TimeUnit.SECONDS); | |
| 42 | + } | |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | 45 | public void delete(String accessToken) { | ... | ... |