修复公共ck到上限后没有清除缓存的问题

This commit is contained in:
CMHopeSunshine 2022-04-27 15:26:54 +08:00
parent 957473e2ce
commit 13976516d8

View File

@ -12,7 +12,7 @@ import datetime
import functools import functools
import inspect import inspect
from nonebot import get_bot from nonebot import get_bot
from .db_util import get_private_cookie, get_cookie_cache, get_public_cookie, limit_public_cookie, update_cookie_cache,get_last_query,update_last_query,delete_cookie from .db_util import get_private_cookie, get_cookie_cache, get_public_cookie, limit_public_cookie, update_cookie_cache,get_last_query,update_last_query,delete_cookie, delete_cookie_cache
async def get_use_cookie(user_id, uid='', mys_id='', action=''): async def get_use_cookie(user_id, uid='', mys_id='', action=''):
cache_cookie = await get_cookie_cache(uid, 'uid') cache_cookie = await get_cookie_cache(uid, 'uid')
@ -69,9 +69,10 @@ async def check_retcode(data, cookie, uid):
elif data['retcode'] == 10101: elif data['retcode'] == 10101:
if cookie['type'] == 'public': if cookie['type'] == 'public':
logger.info(f'{cookie["no"]}号公共cookie达到了每日30次查询上限') logger.info(f'{cookie["no"]}号公共cookie达到了每日30次查询上限')
await limit_public_cookie(cookie['cookie'])
await delete_cookie_cache(cookie['cookie'], key='cookie')
elif cookie['type'] == 'private': elif cookie['type'] == 'private':
logger.info(f'用户{cookie["user_id"]}的uid{cookie["uid"]}私人cookie达到了每日30次查询上限') logger.info(f'用户{cookie["user_id"]}的uid{cookie["uid"]}私人cookie达到了每日30次查询上限')
await limit_public_cookie(cookie['cookie'])
return False return False
else: else:
await update_cookie_cache(cookie['cookie'], uid, 'uid') await update_cookie_cache(cookie['cookie'], uid, 'uid')