Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming 2023-08-29 15:39:23 +08:00
commit 5d32139e09
2 changed files with 6 additions and 7 deletions

View File

@ -135,11 +135,7 @@ type UserProfile struct {
}
// 自平台的注册流程
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (*FsUser, error) {
var err error
user := &FsUser{}
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (user *FsUser, err error) {
logcontent := ""
defer func() {
@ -148,6 +144,8 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
err = u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
user = &FsUser{}
var err error
UserTx := tx.Model(user)
err = UserTx.Where("email = ?", token.Email).Take(user).Error
@ -217,7 +215,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
return nil, err
}
return user, nil
return
}
func (u *FsUserModel) UpdateUserBasicInfoById(ctx context.Context, Id int64, user *UserBasicInfoForSave) (err error) {

View File

@ -15,6 +15,7 @@ import (
"github.com/474420502/requests"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
)
type UserEmailConfirmationLogic struct {
@ -117,7 +118,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
case "fusen":
// log.Println("aaaa", token)
user, err := l.svcCtx.AllModels.FsUser.RegisterByFusen(l.ctx, token)
if err != nil {
if err != nil && err != gorm.ErrRecordNotFound {
logx.Error(err, ":", token.TraceId)
return resp.SetStatus(basic.CodeDbSqlErr)
}