del
All checks were successful
API接口参数变更检测 / api-param-check (push) Successful in 25s

This commit is contained in:
2026-06-04 17:45:00 +08:00
parent 1d35a25c60
commit 03ee22c86d
3 changed files with 37 additions and 63 deletions

View File

@@ -261,40 +261,44 @@ def build_path_change_markdown(
push_time: str,
file_name: 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 == "新增接口":
old_display = "-"
new_display = f"<font color=\"info\">**`{new_uri}`**</font>"
old_display = "`-`"
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新增**</font>"
elif change_type == "删除接口":
old_display = f"<font color=\"warning\">**`{old_uri}`**</font>"
new_display = "<font color=\"comment\">已删除</font>"
old_display = f"<font color=\"warning\">**`{old_uri}`**</font> ← <font color=\"warning\">**已删除**</font>"
new_display = "`已删除`"
else: # 修改路径
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font>" if old_uri else "-"
new_display = f"<font color=\"info\">**`{new_uri}`**</font>" if new_uri else "<font color=\"comment\">已删除</font>"
old_display = f"<font color=\"warning\">~~`{old_uri}`~~</font> ← <font color=\"warning\">**旧路径**</font>"
new_display = f"<font color=\"info\">**`{new_uri}`**</font> ← <font color=\"info\">**新路径**</font>"
parts = [
"# 【API路径变更通知】",
f"- **变更类型:** <font color=\"warning\">**{change_type}**</font>",
f"- **修改人:** {push_user}",
f"- **修改时间:** {push_time}",
f"- **全路径类名:** <font color=\"info\">**{file_name}**</font>",
"",
f" 变更类型: {type_highlight}",
f" 全路径类名: {class_highlight}",
f" 修改人: {push_user}",
f" 修改时间: {push_time}",
"",
"---",
"",
"## URI变更详情",
"",
"---",
"",
"| 项目 | 路径 |",
"|------|------|",
f"| 原路径 | {old_display} |",
f"| 新路径 | {new_display} |",
"#### 【URI变更详情",
f"- **原路径:** {old_display}",
f"- **新路径:** {new_display}",
"",
"---",
]

View File

@@ -1,26 +1,17 @@
# 【API路径变更通知】
- **变更类型:** {新增接口 / 修改路径 / 删除接口}
- **修改人:** {Modifier}
- **修改时间:** {ModifyTime}
- **全路径类名:** {FileName}
变更类型: {新增接口 / 修改路径 / 删除接口}
全路径类名: {FullClassName}
修改人: {Modifier}
修改时间: {ModifyTime}
---
## URI变更详情
---
| 项目 | 路径 |
|------|------|
| 原路径 | `{OldURI}` *(新增时显示:-* |
| 新路径 | `{NewURI}` *(删除时显示:已删除 / -* |
---
#### 【URI变更详情
- **原路径:** `{OldURI}` *(新增时显示:-*
- **新路径:** `{NewURI}` *(删除时显示:已删除 / -*
**示例:**
| 项目 | 路径 |
|------|------|
| 原路径 | `/api/users/{id}` |
| 新路径 | `/api/users/getall` |
- 全路径类名:`com.example.controller.UserController`
- 原路径:`/api/users/{id}`
- 新路径:`/api/users/getall`

View File

@@ -86,27 +86,6 @@ public class CultureClockInController {
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));
}
/**
* 打卡分享 - 打卡