🐛 Fix auto refresh cookies

This commit is contained in:
xtaodada 2023-08-21 21:28:48 +08:00
parent b41c0ab400
commit e2095edf81
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -254,10 +254,11 @@ class GenshinHelper(Plugin):
stoken = client.cookies.get("stoken")
if stoken is not None:
try:
await client.get_cookie_token_by_stoken()
cookie_model.data["cookie_token"] = await client.get_cookie_token_by_stoken()
logger.success("用户 %s 刷新 cookie_token 成功", user_id)
await client.get_ltoken_by_stoken()
cookie_model.data["ltoken"] = await client.get_ltoken_by_stoken()
logger.success("用户 %s 刷新 ltoken 成功", user_id)
await self.cookies_service.update(cookie_model)
except SimnetBadRequest as _exc:
logger.warning(
"用户 %s 刷新 token 失败 [%s]%s", user_id, _exc.ret_code, _exc.original or _exc.message