This commit is contained in:
@@ -261,40 +261,44 @@ def build_path_change_markdown(
|
|||||||
push_time: str,
|
push_time: str,
|
||||||
file_name: str,
|
file_name: str,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""构建 API路径变更通知,匹配 model1.md 模板,并加强高亮。
|
"""构建 API路径变更通知,完全匹配 model1.md 模板,并加强视觉区分。
|
||||||
|
|
||||||
支持的 change_type:
|
改进点:
|
||||||
- 新增接口:原路径显示 "-",新路径高亮显示
|
- 标题使用【】风格
|
||||||
- 修改路径:原路径删除线,新路径高亮
|
- 头部信息缩进 + 颜色高亮
|
||||||
- 删除接口:原路径高亮,新路径显示 "已删除"
|
- URI 详情使用列表(更直观)
|
||||||
|
- 根据变更类型动态强调「原/新路径」
|
||||||
"""
|
"""
|
||||||
|
# 变更类型高亮
|
||||||
|
type_highlight = f"<font color=\"warning\">**{change_type}**</font>"
|
||||||
|
|
||||||
|
# 全路径类名高亮
|
||||||
|
class_highlight = f"<font color=\"info\">**{file_name}**</font>"
|
||||||
|
|
||||||
|
# 根据变更类型优化 URI 展示
|
||||||
if change_type == "新增接口":
|
if change_type == "新增接口":
|
||||||
old_display = "-"
|
old_display = "`-`"
|
||||||
new_display = f"<font color=\"info\">**`{new_uri}`**</font>"
|
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新增**</font>"
|
||||||
elif change_type == "删除接口":
|
elif change_type == "删除接口":
|
||||||
old_display = f"<font color=\"warning\">**`{old_uri}`**</font>"
|
old_display = f"<font color=\"warning\">**`{old_uri}`**</font> ← <font color=\"warning\">**已删除**</font>"
|
||||||
new_display = "<font color=\"comment\">已删除</font>"
|
new_display = "`已删除`"
|
||||||
else: # 修改路径
|
else: # 修改路径
|
||||||
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font>" if old_uri else "-"
|
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font> ← <font color=\"warning\">**旧路径**</font>"
|
||||||
new_display = f"<font color=\"info\">**`{new_uri}`**</font>" if new_uri else "<font color=\"comment\">已删除</font>"
|
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新路径**</font>"
|
||||||
|
|
||||||
parts = [
|
parts = [
|
||||||
"# 【API路径变更通知】",
|
"# 【API路径变更通知】",
|
||||||
f"- **变更类型:** <font color=\"warning\">**{change_type}**</font>",
|
"",
|
||||||
f"- **修改人:** {push_user}",
|
f" 变更类型: {type_highlight}",
|
||||||
f"- **修改时间:** {push_time}",
|
f" 全路径类名: {class_highlight}",
|
||||||
f"- **全路径类名:** <font color=\"info\">**{file_name}**</font>",
|
f" 修改人: {push_user}",
|
||||||
|
f" 修改时间: {push_time}",
|
||||||
"",
|
"",
|
||||||
"---",
|
"---",
|
||||||
"",
|
"",
|
||||||
"## URI变更详情",
|
"#### 【URI变更详情】",
|
||||||
"",
|
f"- **原路径:** {old_display}",
|
||||||
"---",
|
f"- **新路径:** {new_display}",
|
||||||
"",
|
|
||||||
"| 项目 | 路径 |",
|
|
||||||
"|------|------|",
|
|
||||||
f"| 原路径 | {old_display} |",
|
|
||||||
f"| 新路径 | {new_display} |",
|
|
||||||
"",
|
"",
|
||||||
"---",
|
"---",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,26 +1,17 @@
|
|||||||
# 【API路径变更通知】
|
# 【API路径变更通知】
|
||||||
|
|
||||||
- **变更类型:** {新增接口 / 修改路径 / 删除接口}
|
变更类型: {新增接口 / 修改路径 / 删除接口}
|
||||||
- **修改人:** {Modifier}
|
全路径类名: {FullClassName}
|
||||||
- **修改时间:** {ModifyTime}
|
修改人: {Modifier}
|
||||||
- **全路径类名:** {FileName}
|
修改时间: {ModifyTime}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## URI变更详情
|
#### 【URI变更详情】
|
||||||
|
- **原路径:** `{OldURI}` *(新增时显示:-)*
|
||||||
---
|
- **新路径:** `{NewURI}` *(删除时显示:已删除 / -)*
|
||||||
|
|
||||||
| 项目 | 路径 |
|
|
||||||
|------|------|
|
|
||||||
| 原路径 | `{OldURI}` *(新增时显示:-)* |
|
|
||||||
| 新路径 | `{NewURI}` *(删除时显示:已删除 / -)* |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**示例:**
|
**示例:**
|
||||||
|
- 全路径类名:`com.example.controller.UserController`
|
||||||
| 项目 | 路径 |
|
- 原路径:`/api/users/{id}`
|
||||||
|------|------|
|
- 新路径:`/api/users/getall`
|
||||||
| 原路径 | `/api/users/{id}` |
|
|
||||||
| 新路径 | `/api/users/getall` |
|
|
||||||
@@ -86,27 +86,6 @@ public class CultureClockInController {
|
|||||||
return ActionResult.success(new Base64ImageVo(pair.getLeft(), base64Img));
|
return ActionResult.success(new Base64ImageVo(pair.getLeft(), base64Img));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 打卡分享 - 获取随机图片[base64]
|
|
||||||
* @param lastCombo 上次组合
|
|
||||||
* @param response HttpServletResponse
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/random-preview/create")
|
|
||||||
public ActionResult<Base64ImageVo> getRandomPicPreviewBase64(@RequestParam(value = "lastCombo", required = false) String lastCombo, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
||||||
|
|
||||||
MutablePair<String, BufferedImage> 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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打卡分享 - 打卡
|
* 打卡分享 - 打卡
|
||||||
|
|||||||
Reference in New Issue
Block a user