修复软删除和唯一索引同时存在的bug

This commit is contained in:
2025-11-20 17:37:02 +08:00
parent 1f3d3d8a7c
commit da934a9bbb
7 changed files with 80 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ type User struct {
// Username 是用户的登录名,应该是唯一的
// 修正了 gorm 标签的拼写错误 (移除了 gorm 后面的冒号)
Username string `gorm:"unique;not null" json:"username"`
Username string `gorm:"not null" json:"username"`
// Password 存储的是加密后的密码哈希,而不是明文
// json:"-" 标签确保此字段在序列化为 JSON 时被忽略,防止密码泄露