调整openspace方案

This commit is contained in:
2025-10-30 17:23:07 +08:00
parent d235130d11
commit 6228534155
2 changed files with 12 additions and 3 deletions

View File

@@ -59,6 +59,11 @@
- `controller_helpers.go` 中的泛型辅助函数将修改为返回 `error`,以适配 Echo 的错误处理链。
- **Rationale**: 这种重构使得审计逻辑更加清晰和内聚,避免了在中间件中进行复杂的响应体捕获。
7. **DTO 注解 (Annotations)**:
- **From**: `json:"field" binding:"required"`
- **To**: `json:"field" validate:"required"`
- **Rationale**: Gin 使用 `binding` 标签进行请求参数绑定和验证。Echo 框架通常结合 `go-playground/validator` 库进行验证,其对应的标签为 `validate`。因此,所有 DTO 结构体中的 `binding` 标签需要替换为 `validate``json` 标签保持不变。
## Risks / Trade-offs
- **Risk**: 迁移工作量大,可能遗漏某些 Gin 特有的功能或上下文用法,导致运行时错误。