diff --git a/internal/domain/user/entity.go b/internal/domain/user/entity.go index 6eff274..71cd2c9 100644 --- a/internal/domain/user/entity.go +++ b/internal/domain/user/entity.go @@ -24,11 +24,11 @@ const ( // User 用户聚合根 type User struct { Id uint64 `xorm:"pk autoincr 'id'" ` - Username string `xorm:"varchar(50) notnull unique 'username'"` + Username string `xorm:"varchar(50) 'username'"` Phone string `xorm:"varchar(60) unique 'phone'" ` // 密码相关 - Password string `xorm:"varchar(60) notnull 'password'" ` // 使用 bcrypt 加密存储,长度60 - Salt string `xorm:"varchar(32) notnull 'salt'" ` // 密码加密盐值 + Password string `xorm:"varchar(60) 'password'" ` // 使用 bcrypt 加密存储,长度60 + Salt string `xorm:"varchar(32) 'salt'" ` // 密码加密盐值 // 状态相关 Status int8 `xorm:"tinyint(1) default 1 'status'" ` // 登录相关 diff --git a/internal/infrastructure/persistence/auth/auth_repo.go b/internal/infrastructure/persistence/auth/auth_repo.go index db7eff8..4861acc 100644 --- a/internal/infrastructure/persistence/auth/auth_repo.go +++ b/internal/infrastructure/persistence/auth/auth_repo.go @@ -62,6 +62,7 @@ func (a AuthRepositoryORM) LoginByCaptcha(phone string) (string, error) { if !has { //注册用户 u.Phone = phone + u.GiftCount = 2 _, err = a.engine.Insert(u) if err != nil { a.log.Error(err)