fix
This commit is contained in:
parent
7f84cb5173
commit
d6630f4335
|
@ -137,15 +137,9 @@ type UserProfile struct {
|
||||||
// 自平台的注册流程
|
// 自平台的注册流程
|
||||||
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (user *FsUser, err error) {
|
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 {
|
err = u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||||
|
|
||||||
user = &FsUser{}
|
user = &FsUser{}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
UserTx := tx.Model(user)
|
UserTx := tx.Model(user)
|
||||||
err = UserTx.Where("email = ?", token.Email).Take(user).Error
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logcontent += "create."
|
|
||||||
|
|
||||||
// 继承guest_id的资源表
|
// 继承guest_id的资源表
|
||||||
err = InheritGuestIdResource(tx, user.Id, token.GuestId, func(txResouce, txUserMaterial, txUserInfo *gorm.DB) error {
|
err = InheritGuestIdResource(tx, user.Id, token.GuestId, func(txResouce, txUserMaterial, txUserInfo *gorm.DB) error {
|
||||||
userProfile := &UserProfile{
|
userProfile := &UserProfile{
|
||||||
|
@ -191,13 +183,11 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
Ctime: &now,
|
Ctime: &now,
|
||||||
Utime: &now,
|
Utime: &now,
|
||||||
}
|
}
|
||||||
logcontent += "profile."
|
|
||||||
|
|
||||||
err = txUserInfo.Create(uinfo).Error
|
err = txUserInfo.Create(uinfo).Error
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -210,7 +200,6 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
return fmt.Errorf("the email had registered")
|
return fmt.Errorf("the email had registered")
|
||||||
})
|
})
|
||||||
|
|
||||||
logcontent += "end"
|
|
||||||
if err != nil && err != gorm.ErrRecordNotFound {
|
if err != nil && err != gorm.ErrRecordNotFound {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user