feat(player): 注册账号、登录双模式与移动端性能优化
注册必填 7-32 位账号,手机号区号/本地号分存;登录默认账号模式并支持切换手机号登录;Player i18n 拆包与赛事接口优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
ALTER TABLE "user_preferences"
|
||||
ADD COLUMN IF NOT EXISTS "phone_country_dial" VARCHAR(8),
|
||||
ADD COLUMN IF NOT EXISTS "phone_local" VARCHAR(24);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "user_preferences_phone_country_dial_phone_local_idx"
|
||||
ON "user_preferences" ("phone_country_dial", "phone_local");
|
||||
|
||||
-- 回填已有手机号的区号/本地号(username 为纯数字国际号码时)
|
||||
UPDATE "user_preferences" up
|
||||
SET
|
||||
"phone_country_dial" = matched.dial,
|
||||
"phone_local" = SUBSTRING(u.username FROM (LENGTH(matched.dial) + 1))
|
||||
FROM "users" u
|
||||
JOIN LATERAL (
|
||||
SELECT dial FROM (
|
||||
VALUES ('880'), ('886'), ('60'), ('65'), ('66'), ('84'), ('91'), ('61')
|
||||
) AS d(dial)
|
||||
WHERE u.username LIKE d.dial || '%'
|
||||
ORDER BY LENGTH(d.dial) DESC
|
||||
LIMIT 1
|
||||
) matched ON TRUE
|
||||
WHERE up.user_id = u.id
|
||||
AND up.phone IS NOT NULL
|
||||
AND up.phone_country_dial IS NULL
|
||||
AND u.username ~ '^[0-9]+$'
|
||||
AND LENGTH(u.username) >= 10;
|
||||
@@ -85,6 +85,8 @@ model UserPreference {
|
||||
userId BigInt @unique @map("user_id")
|
||||
locale String @default("en-US") @db.VarChar(10)
|
||||
phone String? @db.VarChar(32)
|
||||
phoneCountryDial String? @map("phone_country_dial") @db.VarChar(8)
|
||||
phoneLocal String? @map("phone_local") @db.VarChar(24)
|
||||
email String? @db.VarChar(128)
|
||||
avatarKey String? @map("avatar_key") @db.VarChar(128)
|
||||
allowPasswordChange Boolean @default(true) @map("allow_password_change")
|
||||
@@ -95,6 +97,7 @@ model UserPreference {
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
@@index([phoneCountryDial, phoneLocal])
|
||||
@@map("user_preferences")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user