fix
This commit is contained in:
parent
db2c41f0ce
commit
6baf9cd19c
|
@ -141,12 +141,19 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
|||
user := &FsUser{}
|
||||
|
||||
err := u.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
var err error
|
||||
defer func() {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
err = nil
|
||||
}
|
||||
}()
|
||||
|
||||
UserTx := tx.Model(user)
|
||||
err := UserTx.Where("email = ?", token.Email).Take(user).Error
|
||||
err = UserTx.Where("email = ?", token.Email).Take(user).Error
|
||||
if err != nil {
|
||||
// 没有找到在数据库就创建注册
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
|
||||
FirstName := token.Extend["first_name"].(string)
|
||||
LastName := token.Extend["last_name"].(string)
|
||||
Resetaurant := token.Extend["resetaurant"].(string)
|
||||
|
@ -165,9 +172,8 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
|||
}
|
||||
|
||||
if token.GuestId != 0 {
|
||||
|
||||
// 继承guest_id的资源表
|
||||
return 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{
|
||||
FirstName: FirstName,
|
||||
LastName: LastName,
|
||||
|
|
Loading…
Reference in New Issue
Block a user