fix(login): pcLogin协议真机修正(phone/loginType/companyCode)+secureKey换usercenter端点

浏览器实登抓包确认:POST /usercenter/login/getSecureKey(非newuc GET) +
body {phone,password(RSA-hex),loginType:'yunkecn',companyCode}
实测从500系统错误推进到10300密码错误=协议通,剩加密细节/密码核对(余5次重试暂停试错防锁号)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-20 11:40:16 +08:00
parent 4aeed003a4
commit 5d22d2b5f5
2 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -144,6 +144,7 @@ async def pc_login(
username: str,
password: str,
secure_key: dict[str, Any],
company_code: str = "",
) -> LoginResult:
"""Call ``POST {base}/usercenter/login/pcLogin`` and parse a LoginResult.
@@ -164,9 +165,13 @@ async def pc_login(
httpx client's cookie jar — ``pcLogin``'s ``Set-Cookie`` lands there
automatically.
"""
# 真机抓包(2026-08-20 浏览器实登)确认的字段:phone/loginType/companyCode
# (旧 account 变体一直被拒"缺少登录参数")
body = {
"account": username,
"phone": username,
"password": encrypt_password(password, secure_key),
"loginType": "yunkecn",
"companyCode": company_code,
}
resp = await client.post("/usercenter/login/pcLogin", json=body)
resp.raise_for_status()
+7 -1
View File
@@ -211,8 +211,14 @@ class YunkeClient:
" client was constructed from an existing session."
)
secure_key = await get_secure_key(self._client)
from app.config import get_settings
result = await pc_login(
self._client, self.username, self.password, secure_key
self._client,
self.username,
self.password,
secure_key,
company_code=get_settings().yk_company or "",
)
self.login_result = result
return result