feat(card): 新增非会员卡片展示限制
This commit is contained in:
@@ -294,6 +294,14 @@ async def display_card_status(
|
||||
login_user: LoginUser = Depends(get_current_user_form_http),
|
||||
db_session: AsyncSession = Depends(get_async_session)
|
||||
):
|
||||
# 确认用户展示卡权限
|
||||
if await check_user_card_created_permission(
|
||||
db_session, login_user=login_user, other_conditions={'displayed': True}
|
||||
) is False and action == 'displayed':
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST, detail=f'非会员仅支持展示{settings.USER_MAX_CREATED_CARD_NUM}张卡片'
|
||||
)
|
||||
|
||||
db_crud = CRUD(db_session, UserCollection)
|
||||
result = await db_crud.updates(
|
||||
data={
|
||||
|
||||
Reference in New Issue
Block a user