fix(card): 非会员限制存卡数 非会员限制存卡数量,默认18张
This commit is contained in:
@@ -24,6 +24,7 @@ from core.utils.helper import generate_keyname, check_picture_for_empty
|
||||
|
||||
from . import schema
|
||||
from .scraper import card_scraper
|
||||
from .services import check_user_card_created_permission
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
card_router = APIRouter(prefix='/card', tags=['卡册模块'])
|
||||
@@ -190,6 +191,14 @@ async def created_card(
|
||||
db_session: AsyncSession = Depends(get_async_session)
|
||||
):
|
||||
card_crud = CRUD(db_session, Card)
|
||||
# 确认用户存卡权限
|
||||
if await check_user_card_created_permission(
|
||||
db_session, login_user=login_user
|
||||
) is False:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST, detail=f'非会员仅支持存入{settings.USER_MAX_CREATED_CARD_NUM}张卡片'
|
||||
)
|
||||
|
||||
# 卡片库查询
|
||||
card: Card = await card_crud.get(filters={'cert_number': payload.cert_number})
|
||||
if payload.source.value != 'other':
|
||||
|
||||
Reference in New Issue
Block a user