fix
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"fusenapi/server/fssql"
|
||||
"fusenapi/utils/auth"
|
||||
"time"
|
||||
|
||||
@@ -213,7 +214,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||
Utime: &now,
|
||||
}
|
||||
|
||||
err = txUserInfo.Where("user_id = ?", uinfo.UserId).Take(nil).Error
|
||||
err = txUserInfo.Where("module = 'profile' and user_id = ?", uinfo.UserId).Take(nil).Error
|
||||
// txUserInfo.Statement.Table
|
||||
|
||||
if err != nil {
|
||||
@@ -224,19 +225,14 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
updatesql := `UPDATE %s
|
||||
SET metadata = CASE
|
||||
WHEN metadata IS NULL THEN ?
|
||||
ELSE JSON_MERGE_PATCH(metadata, ?)
|
||||
END
|
||||
WHERE id = ?;`
|
||||
updatesql = fmt.Sprintf(updatesql, txUserInfo.Statement.Table)
|
||||
logx.Error(updatesql)
|
||||
err = txUserInfo.Raw(updatesql, metadata, metadata, uinfo.UserId).Error
|
||||
|
||||
err = fssql.MetadataPATCH(txUserInfo, "profile", FsUser{}, metadata, "user_id = ?", *uinfo.UserId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user