This commit is contained in:
eson 2023-08-29 15:44:01 +08:00
parent 7f84cb5173
commit d6630f4335

View File

@ -137,15 +137,9 @@ type UserProfile struct {
// 自平台的注册流程
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (user *FsUser, err error) {
logcontent := ""
defer func() {
logx.Info("aaaa:", logcontent, " ", err.Error())
}()
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
@ -169,8 +163,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
return err
}
logcontent += "create."
// 继承guest_id的资源表
err = InheritGuestIdResource(tx, user.Id, token.GuestId, func(txResouce, txUserMaterial, txUserInfo *gorm.DB) error {
userProfile := &UserProfile{
@ -191,13 +183,11 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
Ctime: &now,
Utime: &now,
}
logcontent += "profile."
err = txUserInfo.Create(uinfo).Error
if err == gorm.ErrRecordNotFound {
return nil
}
return err
})
@ -210,7 +200,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
return fmt.Errorf("the email had registered")
})
logcontent += "end"
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}