refactor: BaseModel 主键列名统一 uid→id

- BaseModel 移除 gorm column:uid 和 json:uid 标签,统一为 id
- 更新 8 个 repository 文件中 28 处 raw SQL 列引用 (uid→id)
- 更新 3 个前端 JS 文件中 14 处 API 响应字段引用 (uid→id)
- 添加数据库迁移 SQL 脚本 (docs/migrations/001_uid_to_id.sql)
This commit is contained in:
2026-06-02 19:17:57 +08:00
parent 7fdea90ded
commit 5911cee01c
13 changed files with 70 additions and 43 deletions

View File

@ -31,7 +31,7 @@ func (r *LevelRepo) FindByID(id uint) (*model.User, error) {
// AddExp 原子增加用户经验值
func (r *LevelRepo) AddExp(userID uint, delta int) error {
return r.db.Model(&model.User{}).
Where("uid = ?", userID).
Where("id = ?", userID).
UpdateColumn("exp", gorm.Expr("exp + ?", delta)).Error
}