From 83cacb8db8b3350d289e3c7a438ca2790f7a5026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B8=85?= <6581896+oncream@user.noreply.gitee.com> Date: Wed, 2 Apr 2025 10:24:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(1.0.2):=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A1=A8=E7=BB=93=E6=9E=84=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=8D=E8=B4=B9=E6=AC=A1=E6=95=B02=E6=AC=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/domain/user/entity.go | 6 +++--- internal/infrastructure/persistence/auth/auth_repo.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) 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)