first init

This commit is contained in:
xingc
2025-02-18 14:26:47 +08:00
commit 48a02974fc
41 changed files with 2297 additions and 0 deletions

6
core/base/__init__.py Normal file
View File

@@ -0,0 +1,6 @@
# -*- coding = utf-8 -*-
# @Time : 2025/2/14 上午10:50
# @File : __init__.py.py
# @Software : PyCharm
# @Author : xingc
# @Desc :

19
core/base/exceptions.py Normal file
View File

@@ -0,0 +1,19 @@
# -*- coding = utf-8 -*-
# @Time : 2025/2/16 下午10:05
# @File : exceptions.py
# @Software : PyCharm
# @Author : xingc
# @Desc :
class BaseException(Exception):
pass
class SearchCardNotFound(Exception):
"""搜索卡片不存在"""
pass
class SearchCardRetry(Exception):
"""搜索重试"""
pass

55
core/base/schema.py Normal file
View File

@@ -0,0 +1,55 @@
# -*- coding = utf-8 -*-
# @Time : 2025/2/13 下午5:01
# @File : schema.py
# @Software : PyCharm
# @Author : xingc
# @Desc :
import enum
from typing import Optional, Generic, TypeVar
from pydantic import BaseModel
T = TypeVar('T')
class BaseResponse(BaseModel, Generic[T]):
code: int = 200
message: str = 'success'
data: Optional[T] = None
class Paginated(BaseModel, Generic[T]):
list: Optional[T] = None
total: int
page: int
page_size: int
class SupportPlatformType(enum.Enum):
PSA = 'psa'
BGS = 'bgs'
CGC = 'cgc'
GBTC = 'gbtc'
CCG = 'ccg'
BCTC = 'bctc'
class PlatformSourceType(enum.Enum):
PSA = 'psa'
BGS = 'bgs'
CGC = 'cgc'
GBTC = 'gbtc'
CCG = 'ccg'
BCTC = 'bctc'
OTHER = 'other'
class MessageType(enum.Enum):
TEXT = 'text'
IMAGE = 'image'
class CardCategoryType(enum.Enum):
SPORTS = 'sports'
ANIME = 'anime'
OTHER = 'other'