稳定性: 签到失败10分钟自动重试+前端显示Cookie剩余天数+每天9点Cookie过期预警
This commit is contained in:
@@ -148,7 +148,26 @@ async def get_account(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
account = await _get_owned_account(account_id, user, db)
|
||||
return success_response(_account_to_dict(account), "Account retrieved")
|
||||
data = _account_to_dict(account)
|
||||
|
||||
# 解析 Cookie 中的 ALF 字段获取过期时间
|
||||
try:
|
||||
key = _encryption_key()
|
||||
cookie_str = decrypt_cookie(account.encrypted_cookies, account.iv, key)
|
||||
for pair in cookie_str.split(";"):
|
||||
pair = pair.strip()
|
||||
if pair.startswith("ALF="):
|
||||
alf = pair.split("=", 1)[1].strip()
|
||||
if alf.isdigit():
|
||||
from datetime import datetime as _dt
|
||||
expire_dt = _dt.fromtimestamp(int(alf))
|
||||
data["cookie_expire_date"] = expire_dt.strftime("%Y-%m-%d")
|
||||
data["cookie_expire_days"] = (expire_dt - _dt.now()).days
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return success_response(data, "Account retrieved")
|
||||
|
||||
|
||||
# ---- UPDATE ----
|
||||
|
||||
Reference in New Issue
Block a user