You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
27 lines
1.0 KiB
|
2 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""抽样输出若干 .bru 的响应区块,供人工核对说明列质量。"""
|
||
|
|
import re
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
DOCS = Path(r"D:\code\crm-api-docs\A4 客户管理")
|
||
|
|
SAMPLES = [
|
||
|
|
"客户详情/关联商机/关联商机页签.bru",
|
||
|
|
"客户公海/下载导入模板.bru",
|
||
|
|
"客户公海/读取列偏好.bru",
|
||
|
|
"客户详情/操作日志/操作日志分页.bru",
|
||
|
|
"客户详情/跟进记录/跟进记录分页.bru",
|
||
|
|
"我的客户/工商信息查询.bru",
|
||
|
|
]
|
||
|
|
out = []
|
||
|
|
for rel in SAMPLES:
|
||
|
|
p = DOCS / rel
|
||
|
|
if not p.exists():
|
||
|
|
out.append(f"=== {rel} [缺失] ===\n")
|
||
|
|
continue
|
||
|
|
text = p.read_text(encoding="utf-8-sig")
|
||
|
|
m = re.search(r'## 响应 data 结构.*?(?=\n ## 响应示例|\n ## 错误码|\n\}\s*$|\Z)', text, re.S)
|
||
|
|
block = m.group(0) if m else "[未找到响应 data 结构区块]"
|
||
|
|
out.append(f"\n\n========== {rel} ==========\n{block}")
|
||
|
|
Path(r"d:\code\crm-backend-matt\.scratch\a4-doc-fields\sample_blocks.txt").write_text("".join(out), encoding="utf-8")
|
||
|
|
print("ok")
|