/admin/compliance/legal-documents
创建一条协议文档(doc_type/lang/version 白名单校验;状态从 draft 起步)。租户归属以认证上下文(JWT/头解析)为准,请求体 tenant_id 不得越权(DA P1-2 修复)。
请求体
Schema: service-compliance/internal/handler/dto.CreateLegalDocumentRequest
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
content |
string |
是 | [{"title":"1. 引言","body":"..."}] |
||
doc_type |
string |
是 | terms |
||
lang |
string |
是 | zh-CN |
||
title |
string |
是 | 服务条款 |
||
version |
string |
是 | v1 |
||
effective_at |
string |
否 | 2026-06-09T00:00:00Z |
||
tenant_id |
string |
否 | 01JQ...(空=平台级) |
响应
| 状态 | 描述 | Schema |
|---|---|---|
| 201 | created | service-compliance/internal/handler/dto.LegalDocumentItemResponse |
| 400 | bad request | service-compliance/internal/handler/dto.ErrorResponse |
| 403 | tenant_id in body does not match authenticated tenant | service-compliance/internal/handler/dto.ErrorResponse |
引用的 Schema
service-compliance/internal/handler/dto.ErrorResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | 400 |
||
message |
string |
否 | invalid request |
service-compliance/internal/handler/dto.LegalDocumentItem
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
content |
string |
否 | [{"title":"1. 引言","body":"..."}] |
||
doc_type |
string |
否 | terms |
||
effective_at |
string |
否 | 2026-06-09T00:00:00Z |
||
id |
string |
否 | 01JQ... |
||
lang |
string |
否 | zh-CN |
||
status |
string |
否 | published |
||
tenant_id |
string |
否 | |
||
title |
string |
否 | 服务条款 |
||
version |
string |
否 | v1 |
service-compliance/internal/handler/dto.LegalDocumentItemResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | |||
data |
service-compliance/internal/handler/dto.LegalDocumentItem |
否 | |||
message |
string |
否 | |||
timestamp |
string |
否 |