Files
platforms/docs/操作日志_用户地址编辑数据类型修复_20260811.md
2026-08-11 20:18:43 +08:00

36 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 用户地址编辑数据类型修复操作日志
操作时间2026-08-11
操作类型:修改
影响模块:平台总后台用户地址编辑接口
## 操作前状态
用户地址编辑接口将 `gin.H` 直接传给 GORM `Updates`。当前 GORM 无法把该具名映射识别为受支持的标准更新映射,保存时在生成 SQL 前返回 `unsupported data`
## 具体操作
- 新增 `userAddressUpdateValues`,集中构造标准 `map[string]any` 更新参数。
- 保留用户、地址、经纬度和默认地址五个原有更新字段。
- 新增回归测试,覆盖空经纬度与 `is_default=false` 的保存场景。
## 操作后状态
用户地址编辑使用 GORM 支持的标准映射类型。接口、数据库字段和业务规则均未变化,不需要数据库迁移。
## 代码变更
- `backend/api/internal/logic/platform/user/relation.go`:修复用户地址更新参数类型。
- `backend/api/internal/logic/platform/user/relation_test.go`:新增更新参数回归测试。
## 验证结果
- `go test ./internal/logic/platform/user ./internal/routers`:通过。
- `go test ./...`:其余已执行包通过;`cmd/cli``cmd/main``internal/routers` 在加载 Go 系统构建缓存时遇到 Windows `Access is denied`,属于本地构建缓存访问限制,并非测试断言失败。其中 `internal/routers` 已在前述定向命令中单独通过。
## 风险评估
风险较低。修改仅影响用户地址编辑时的更新参数构造,不改变创建流程、数据结构、公开接口或事务边界。