This commit is contained in:
eson 2023-09-10 03:09:48 +08:00
parent 14f0dd2b22
commit 5bedfc9237
2 changed files with 2 additions and 6 deletions

View File

@ -218,21 +218,17 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
// txUserInfo.Statement.Table // txUserInfo.Statement.Table
if err != nil { if err != nil {
if err == gorm.ErrRecordNotFound { if err == gorm.ErrRecordNotFound {
err = txUserInfo.Create(uinfo).Error err = txUserInfo.Create(uinfo).Error
if err == gorm.ErrRecordNotFound { if err == gorm.ErrRecordNotFound {
return nil return nil
} }
} }
} else { } else {
err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUserInfo{}, metadata, "user_id = ?", *uinfo.UserId)
err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUser{}, metadata, "user_id = ?", *uinfo.UserId)
if err != nil { if err != nil {
return err return err
} }
} }
return err return err
}) })

View File

@ -116,7 +116,7 @@ func MetadataResourcePATCH(tx *gorm.DB, rid string, updateMetadata any, values .
ELSE JSON_MERGE_PATCH(metadata, ?) ELSE JSON_MERGE_PATCH(metadata, ?)
END END
cond, ok := values[0].(string) cond, ok := values[0].(string)
WHERE resource_id = '%s'` + "and " + cond + `;` WHERE resource_id = '%s'` + " and " + cond + `;`
} }
var err error var err error