diff --git a/.gitea/checker/comparator.py b/.gitea/checker/comparator.py
index 418168f..95bda87 100644
--- a/.gitea/checker/comparator.py
+++ b/.gitea/checker/comparator.py
@@ -83,6 +83,7 @@ class EndpointChangeReport:
http_method: str
controller_class: str
method_name: str
+ source_file: str = ""
parameter_changes: List[ParameterChange] = field(default_factory=list)
is_new_endpoint: bool = False
is_removed_endpoint: bool = False
@@ -257,6 +258,7 @@ def compare_endpoints(
http_method=a_ep.http_method,
controller_class=a_ep.controller_class,
method_name=a_ep.method_name,
+ source_file=a_ep.source_file,
is_renamed_endpoint=True,
old_uri=r_ep.uri,
)
@@ -274,6 +276,7 @@ def compare_endpoints(
http_method=ep.http_method,
controller_class=ep.controller_class,
method_name=ep.method_name,
+ source_file=ep.source_file,
is_removed_endpoint=True,
)
)
@@ -287,6 +290,7 @@ def compare_endpoints(
http_method=ep.http_method,
controller_class=ep.controller_class,
method_name=ep.method_name,
+ source_file=ep.source_file,
is_new_endpoint=True,
parameter_changes=[
ParameterChange(
@@ -312,6 +316,7 @@ def compare_endpoints(
http_method=new_ep.http_method,
controller_class=new_ep.controller_class,
method_name=new_ep.method_name,
+ source_file=new_ep.source_file,
parameter_changes=param_changes,
)
)
diff --git a/.gitea/checker/notifier.py b/.gitea/checker/notifier.py
index 8cd4a4c..5632ac1 100644
--- a/.gitea/checker/notifier.py
+++ b/.gitea/checker/notifier.py
@@ -25,26 +25,28 @@ def truncate_text(text: str, max_length: int = MAX_MD_LENGTH) -> str:
def _format_endpoint_block(report: EndpointChangeReport) -> str:
"""
格式化单个接口块,按模板匹配格式输出。
+ 全路径类名显示为 source_file(相对仓库根的完整 .java 路径)。
"""
change_type = "新增接口" if report.is_new_endpoint else ("删除接口" if report.is_removed_endpoint else "修改参数")
uri_line = f"**{report.http_method}** `{report.uri}`"
- class_line = f"- **全路径类名:** {report.controller_class}"
+ file_path = report.source_file or report.controller_class
+ class_line = f"- **全路径类名:** **{file_path}**"
header = [
- f"- **变更类型:** {change_type}",
+ f"- **变更类型:** **{change_type}**",
f"- **URI:** {uri_line}",
class_line,
]
if report.is_removed_endpoint:
- return "\n".join(header + [f"该接口已被移除"])
+ return "\n".join(header + ["", f"**该接口已被移除**"])
detail_lines = ["", "---", "", "## 接口参数变动详情", "", "---", ""]
if report.is_new_endpoint:
- detail_lines.append("### 新增接口参数")
+ detail_lines.append("### **新增接口参数**")
else:
- detail_lines.append("### 参数变更明细")
+ detail_lines.append("### **参数变更明细**")
if report.parameter_changes:
for change in report.parameter_changes:
@@ -92,7 +94,7 @@ def build_markdown_notification(
change_type="修改路径",
push_user=push_user,
push_time=push_time,
- file_name=report.controller_class,
+ file_name=report.source_file or report.controller_class,
)
parts.append(path_md)
parts.append("")
@@ -245,13 +247,16 @@ def build_path_change_markdown(
push_time: str,
file_name: str,
) -> str:
- """构建 API路径变更通知,匹配 model1.md 模板。"""
+ """构建 API路径变更通知,匹配 model1.md 模板,并加强高亮。"""
+ old_display = f"~~`{old_uri}`~~" if old_uri else "-"
+ new_display = f"**`{new_uri}`**" if new_uri else "已删除"
+
parts = [
"# API路径变更通知",
- f"- **变更类型:** {change_type}",
+ f"- **变更类型:** **{change_type}**",
f"- **修改人:** {push_user}",
f"- **修改时间:** {push_time}",
- f"- **全路径类名:** {file_name}",
+ f"- **全路径类名:** **{file_name}**",
"",
"---",
"",
@@ -261,8 +266,8 @@ def build_path_change_markdown(
"",
"| 项目 | 路径 |",
"|------|------|",
- f"| 原路径 | `{old_uri if old_uri else '-'}` |",
- f"| 新路径 | `{new_uri if new_uri else '已删除'}` |",
+ f"| 原路径 | {old_display} |",
+ f"| 新路径 | {new_display} |",
"",
"---",
]