feat(web): 虎牙账号管理界面优化 — 登录渠道区分 (Web 旧版 / App 协议 / 短信)

后端:
- HuyaAccount 新增 login_channel 字段 + 迁移 20260829_0030 (启动自动升级)
- 5 个登录端点成功后记录渠道: web/app 批量与单账号 + 短信
- HuyaAccountOut 输出 login_channel
前端:
- 账号表新增『登录渠道』列 (App 协议/Web 旧版/短信/仅导入)
- 工具栏登录按钮分组: App 协议登录(primary 推荐) 与 Web 登录(旧版, Tooltip 说明)
- 行内操作新增单账号 App/Web 登录按钮 (复用批量端点传单 id)
- tsc + vite build 通过
This commit is contained in:
yml2213
2026-08-29 13:13:57 +08:00
parent 9653dbe3ba
commit d6ab4d8699
6 changed files with 153 additions and 24 deletions
+7
View File
@@ -283,6 +283,7 @@ def _account_out(account: HuyaAccount, include_cookie: bool = True) -> HuyaAccou
tag=account.tag or "",
remark=account.remark or "",
status=account.status or "",
login_channel=getattr(account, "login_channel", "") or "",
points=account.points,
game_name=account.game_name or "",
game_channel=account.game_channel or "",
@@ -308,6 +309,7 @@ def _account_out_light(account: HuyaAccount, *, has_password: bool = False) -> H
tag=account.tag or "",
remark=account.remark or "",
status=account.status or "",
login_channel=getattr(account, "login_channel", "") or "",
points=account.points,
game_name=account.game_name or "",
game_channel=account.game_channel or "",
@@ -555,6 +557,7 @@ def password_login_account(
if hasattr(account, "account_password") and req.password:
account.account_password = req.password
account.status = "active"
account.login_channel = "web"
db.commit()
except ValueError as exc:
raise HTTPException(status_code=502, detail=str(exc)) from exc
@@ -597,6 +600,7 @@ def app_password_login_account(
if hasattr(account, "account_password") and req.password:
account.account_password = req.password
account.status = "active"
account.login_channel = "app"
db.commit()
except ValueError as exc:
raise HTTPException(status_code=502, detail=str(exc)) from exc
@@ -662,6 +666,7 @@ def sms_login_account(
try:
account = upsert_huya_cookie(db, result.cookie, tag=req.tag, username_hint="")
account.login_channel = "sms"
phone = (req.phone or "").strip()
if phone:
account.game_phone = phone
@@ -921,6 +926,7 @@ def password_login_selected_accounts(
tag=account.tag or "",
username_hint=username,
)
saved.login_channel = "web"
success_count += 1
results.append({
"line": account.id,
@@ -1053,6 +1059,7 @@ def app_password_login_selected_accounts(
username_hint=username,
)
saved.status = "active"
saved.login_channel = "app"
db.commit()
success_count += 1
results.append({