fix: 保活时续上即席查询的单点票据

This commit is contained in:
2026-11-09 17:36:19 +08:00
parent fe5d06f8d9
commit 152cf92df9
3 changed files with 14 additions and 0 deletions
+2
View File
@@ -259,6 +259,7 @@ async def nqi_finish(body: dict) -> dict:
pass
return {**_captcha_body(session_id, challenge), "status": "need_captcha", "message": message}
challenge.password = ""
await client.renew_ticket()
cookies = client.export_cookies()
await client.aclose()
drop(session_id)
@@ -679,6 +680,7 @@ async def _resume(cookies: list):
try:
client.import_cookies(cookies)
user = await client.current_user()
await client.renew_ticket()
return user, client.export_cookies()
except NqiAuthError:
return None
+10
View File
@@ -315,6 +315,16 @@ class NqiClient:
async def current_user(self) -> dict:
return _public_user(await self._cas_user_payload())
async def renew_ticket(self) -> bool:
"""用单点票据进入即席查询。票据还有效时,这一步会把它续上。"""
from app.nqi.adhoc import ensure_session
try:
await ensure_session(self)
except NqiAuthError:
return False
return True
async def touch_session(self) -> dict:
data = await self._cas_user_payload()
await self._touch_password()
+2
View File
@@ -313,6 +313,8 @@ async def _touch(cookies: list):
try:
client.import_cookies(cookies)
user = await client.touch_session()
if not await client.renew_ticket():
logger.info("门户登录仍有效,单点票据没有续上")
return True, user, client.export_cookies()
except NqiAuthError:
return False, None, cookies