修复 affiliate-dash 重复绑定与提交前校验:UID 未变复用绑定防重复生成二维码、提交前强制刷新绑定状态、UID 仅允许纯数字且限 15 位

This commit is contained in:
yml2213
2026-08-06 23:46:02 +08:00
parent 8756a196ae
commit 17acd65f28
6 changed files with 61 additions and 13 deletions
@@ -15,7 +15,8 @@ export type {
ClaimIdentityPayload,
} from '../../types/claim-identity.js'
const CLAIM_UID_MAX_LENGTH = 64
// 游戏 UID(角色编号)长度上限:91 单号为 16 位纯数字,防止用户把 91 单号误当 UID 提交。
const CLAIM_UID_MAX_LENGTH = 15
export function normalizeClaimUid(value: unknown): string {
return String(value || '')
@@ -39,8 +40,8 @@ export function assertValidClaimUid(value: unknown): string {
})
}
if (!/^[A-Za-z0-9_\-]+$/.test(uid)) {
throw createHttpError('UID 仅支持字母、数字、下划线和中划线', {
if (!/^[0-9]+$/.test(uid)) {
throw createHttpError('UID 仅支持纯数字', {
statusCode: 400,
errorCode: 'claim_uid_invalid',
})