fix:优化

This commit is contained in:
nieziyan 2024-05-15 09:13:54 +08:00
parent 4bb2518d36
commit ff2f73eb41
2 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,8 @@ public class TemplateUtil {
for (String key : keys) { for (String key : keys) {
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent)); contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
} }
templateContent = CollUtil.join(contents, "#"); String join = StrUtil.SPACE + "#" + StrUtil.SPACE;
templateContent = CollUtil.join(contents, join);
String content = FreemarkerParseFactory String content = FreemarkerParseFactory
.parseTemplateContent(templateContent, data, true); .parseTemplateContent(templateContent, data, true);
messageDTO.setContent(content); messageDTO.setContent(content);
@ -102,7 +103,8 @@ public class TemplateUtil {
for (String key : keys) { for (String key : keys) {
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent)); contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
} }
templateContent = CollUtil.join(contents, "#"); String join = StrUtil.SPACE + "#" + StrUtil.SPACE;
templateContent = CollUtil.join(contents, join);
String content = FreemarkerParseFactory String content = FreemarkerParseFactory
.parseTemplateContent(templateContent, data, true); .parseTemplateContent(templateContent, data, true);
messageDTO.setContent(content); messageDTO.setContent(content);

View File

@ -164,8 +164,8 @@ public class TokenUtils {
String secret = CommonConstant.TEMP_TOKEN_SECRET; String secret = CommonConstant.TEMP_TOKEN_SECRET;
// 模拟登录生成Token // 模拟登录生成Token
String token = JwtUtil.sign(username, secret); String token = JwtUtil.sign(username, secret);
// 设置Token缓存有效时间为 3 分钟 // 设置Token缓存有效时间为 60
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token, 3 * 60); redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token, 60);
return token; return token;
} }
} }