diff --git a/.gitea/checker/notifier.py b/.gitea/checker/notifier.py index 638f193..6e79b9e 100644 --- a/.gitea/checker/notifier.py +++ b/.gitea/checker/notifier.py @@ -279,7 +279,7 @@ def build_path_change_markdown( new_display = f"**`{new_uri}`**" if new_uri else "已删除" parts = [ - "# API路径变更通知", + "# 【API路径变更通知】", f"- **变更类型:** **{change_type}**", f"- **修改人:** {push_user}", f"- **修改时间:** {push_time}", diff --git a/.gitea/model1.md b/.gitea/model1.md index ebd0174..e89b794 100644 --- a/.gitea/model1.md +++ b/.gitea/model1.md @@ -1,4 +1,4 @@ -# API路径变更通知 +# 【API路径变更通知】 - **变更类型:** {新增接口 / 修改路径 / 删除接口} - **修改人:** {Modifier} diff --git a/ftb/src/main/java/ftb/test/controller/CultureClockInController.java b/ftb/src/main/java/ftb/test/controller/CultureClockInController.java index 72a95e1..f2cdc5d 100644 --- a/ftb/src/main/java/ftb/test/controller/CultureClockInController.java +++ b/ftb/src/main/java/ftb/test/controller/CultureClockInController.java @@ -86,6 +86,27 @@ public class CultureClockInController { return ActionResult.success(new Base64ImageVo(pair.getLeft(), base64Img)); } + /** + * 打卡分享 - 获取随机图片[base64] + * @param lastCombo 上次组合 + * @param response HttpServletResponse + */ + @GetMapping(value = "/random-preview/create") + public ActionResult getRandomPicPreviewBase64(@RequestParam(value = "lastCombo", required = false) String lastCombo, HttpServletRequest request, HttpServletResponse response) throws Exception { + + MutablePair pair = cultureClockInService.getRandomPicPreview(lastCombo, requestUrl); + if (pair == null || pair.getRight() == null) { + throw new Exception("获取图片失败,请重试"); + } + byte[] bytes; + try (ByteArrayOutputStream output = new ByteArrayOutputStream()) { + ImageIO.write(pair.getRight(), "png", output); + bytes = output.toByteArray(); + } + String base64 = Base64.getEncoder().encodeToString(bytes); + String base64Img = "data:image/png;base64," + base64; + return ActionResult.success(new Base64ImageVo(pair.getLeft(), base64Img)); + } /** * 打卡分享 - 打卡