fix(web): 审核回归 — 5 项修复 (渠道写入丢失/斗鱼WS生命周期/归属校验/恢复订阅/画像key稳定)
B1 routers/huya.py: 批量 Web 登录 login_channel/status 回填在 helper 内部 commit 之后赋值且未再提交 → 丢失; 补 db.commit() 并统一 status=active B2 routers/login.py + services/login_service.py: 斗鱼登录 WS 断线即 pop 批次, 刷新后无法重连订阅 → 对齐虎牙模式 (BatchRegistry.mark_finished, 仅结束后清理) B3 routers/login.py: WS 增加批次归属校验 (非 view_all 仅可订阅自建批次) S1 LoginTasksPage: effectiveBatchId 从任务列表推导活跃批次, 刷新后停止按钮/ 日志订阅自动恢复 S4 services/huya_service.py: username 仅在为空时回填, 防止 udb_passport 覆盖 登录名导致一号一设备绑定 key 漂移 验证: 77 后端单测 OK; tsc + vite build OK
This commit is contained in:
@@ -229,7 +229,10 @@ def _upsert_huya_account(db: Session, parsed: dict, tag: str = "", status: str |
|
||||
else:
|
||||
account.uid = parsed["uid"] or account.uid
|
||||
account.yyuid = parsed["yyuid"] or account.yyuid
|
||||
account.username = parsed["username"] or account.username
|
||||
# 已存在账号保留原有 username(登录名/设备画像 key),避免重复导入或登录
|
||||
# 前后 udb_passport 差异导致一号一设备绑定断裂。
|
||||
if not account.username:
|
||||
account.username = parsed["username"] or ""
|
||||
account.cookie = parsed["cookie"]
|
||||
account.game_phone = parsed["game_phone"] or account.game_phone
|
||||
if tag:
|
||||
@@ -254,7 +257,11 @@ def save_huya_login_cookie_to_account(
|
||||
|
||||
account.uid = parsed["uid"] or account.uid
|
||||
account.yyuid = parsed["yyuid"] or account.yyuid
|
||||
account.username = parsed["username"] or account.username
|
||||
# 保留已有 username(登录名): 设备画像/指纹状态目录按登录用户名分账号隔离,
|
||||
# 若被 cookie 里的 udb_passport 覆盖, 下一次登录会拿到不同的 key → 生成全新设备,
|
||||
# 一号一设备绑定断裂且绑定页出现两条记录。仅在无用户名时回填。
|
||||
if not account.username:
|
||||
account.username = parsed["username"] or ""
|
||||
account.cookie = parsed["cookie"]
|
||||
account.game_phone = parsed["game_phone"] or account.game_phone
|
||||
if tag:
|
||||
|
||||
Reference in New Issue
Block a user