diff --git a/model/gmodel/fs_user_logic.go b/model/gmodel/fs_user_logic.go index dd0cf675..79a3d1fa 100644 --- a/model/gmodel/fs_user_logic.go +++ b/model/gmodel/fs_user_logic.go @@ -218,21 +218,17 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT // txUserInfo.Statement.Table if err != nil { - if err == gorm.ErrRecordNotFound { err = txUserInfo.Create(uinfo).Error if err == gorm.ErrRecordNotFound { return nil } } - } else { - - err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUser{}, metadata, "user_id = ?", *uinfo.UserId) + err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUserInfo{}, metadata, "user_id = ?", *uinfo.UserId) if err != nil { return err } - } return err }) diff --git a/utils/fssql/metadata.go b/utils/fssql/metadata.go index e56385b0..143354c0 100644 --- a/utils/fssql/metadata.go +++ b/utils/fssql/metadata.go @@ -116,7 +116,7 @@ func MetadataResourcePATCH(tx *gorm.DB, rid string, updateMetadata any, values . ELSE JSON_MERGE_PATCH(metadata, ?) END cond, ok := values[0].(string) - WHERE resource_id = '%s'` + "and " + cond + `;` + WHERE resource_id = '%s'` + " and " + cond + `;` } var err error