diff --git a/LittlePaimon/utils/api.py b/LittlePaimon/utils/api.py index 7f84e08..e2afde0 100644 --- a/LittlePaimon/utils/api.py +++ b/LittlePaimon/utils/api.py @@ -155,18 +155,27 @@ async def check_retcode(data: dict, cookie_info, cookie_type: str, user_id: str, elif cookie_info.status == 0: await cookie_info.delete() logger.info('原神Cookie', f'用户{user_id}的私人cookie{uid}连续失效,已删除') - else: + elif cookie_type == 'public': await CookieCache.filter(cookie=cookie_info.cookie).delete() await cookie_info.delete() logger.info('原神Cookie', f'{cookie_info.id}号公共cookie已失效,已删除') + else: + await PublicCookie.filter(cookie=cookie_info.cookie).delete() + await cookie_info.delete() + logger.info('原神Cookie', f'UID{cookie_info.uid}使用的缓存cookie已失效,已删除') return False elif data['retcode'] == 10101: cookie_info.status = 2 - await cookie_info.save() - if cookie_info == 'private': + if cookie_type == 'private': + cookie_info.status = 2 logger.info('原神Cookie', f'用户{user_id}的私人cookie{uid}已达到每日30次查询上限') - else: + elif cookie_type == 'public': + cookie_info.status = 2 logger.info('原神Cookie', f'{cookie_info.id}号公共cookie已达到每日30次查询上限') + else: + await PublicCookie.filter(cookie=cookie_info.cookie).update(status=2) + logger.info('原神Cookie', f'UID{cookie_info.uid}使用的缓存cookie已达到每日30次查询上限') + await cookie_info.save() return False else: if cookie_type == 'public':