mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-22 06:17:54 +00:00
🔧 修改 Cookie
写入到数据库的声明类型
This commit is contained in:
parent
5eb741070d
commit
e5890201a3
@ -13,7 +13,7 @@ class CookiesRepository:
|
||||
def __init__(self, mysql: MySQL):
|
||||
self.mysql = mysql
|
||||
|
||||
async def add_cookies(self, user_id: int, cookies: str, region: RegionEnum):
|
||||
async def add_cookies(self, user_id: int, cookies: dict, region: RegionEnum):
|
||||
async with self.mysql.Session() as session:
|
||||
session = cast(AsyncSession, session)
|
||||
if region == RegionEnum.HYPERION:
|
||||
@ -25,7 +25,7 @@ class CookiesRepository:
|
||||
await session.add(db_data)
|
||||
await session.commit()
|
||||
|
||||
async def update_cookies(self, user_id: int, cookies: str, region: RegionEnum):
|
||||
async def update_cookies(self, user_id: int, cookies: dict, region: RegionEnum):
|
||||
async with self.mysql.Session() as session:
|
||||
session = cast(AsyncSession, session)
|
||||
if region == RegionEnum.HYPERION:
|
||||
|
@ -14,10 +14,10 @@ class CookiesService:
|
||||
def __init__(self, cookies_repository: CookiesRepository) -> None:
|
||||
self._repository: CookiesRepository = cookies_repository
|
||||
|
||||
async def update_cookies(self, user_id: int, cookies: str, region: RegionEnum):
|
||||
async def update_cookies(self, user_id: int, cookies: dict, region: RegionEnum):
|
||||
await self._repository.update_cookies(user_id, cookies, region)
|
||||
|
||||
async def add_cookies(self, user_id: int, cookies: str, region: RegionEnum):
|
||||
async def add_cookies(self, user_id: int, cookies: dict, region: RegionEnum):
|
||||
await self._repository.add_cookies(user_id, cookies, region)
|
||||
|
||||
async def get_cookies(self, user_id: int, region: RegionEnum):
|
||||
|
Loading…
Reference in New Issue
Block a user