diff --git a/service/admin.py b/service/admin.py index ed97ed79..799d5ffb 100644 --- a/service/admin.py +++ b/service/admin.py @@ -1,8 +1,10 @@ +import logging from typing import List from pymysql import IntegrityError from config import config +from logger import Log from service.repository import AsyncRepository from service.cache import RedisCache @@ -25,7 +27,8 @@ class AdminService: async def add_admin(self, user_id: int) -> bool: try: await self.repository.add_admin(user_id) - except IntegrityError: + except IntegrityError as error: + Log.warning(f"{user_id} 已经存在数据库 \n", error) pass admin_list = await self.repository.get_admin() for config_admin in config.ADMINISTRATORS: