Commit 7678a8aa authored by 张会鑫's avatar 张会鑫

代码提交

parent 66c90ffa
...@@ -186,3 +186,6 @@ thirdparty ...@@ -186,3 +186,6 @@ thirdparty
/i18n/locales/**/**/*_ai_translated.po /i18n/locales/**/**/*_ai_translated.po
/i18n/locales/**/**/*~ /i18n/locales/**/**/*~
/env_name /env_name
/file
\ No newline at end of file
...@@ -43,9 +43,8 @@ class MediaDal(DalBase): ...@@ -43,9 +43,8 @@ class MediaDal(DalBase):
await self.db.execute(sql) await self.db.execute(sql)
async def get_count_by_groupIds(self, ids: list) -> int: async def get_count_by_groupIds(self, ids: list) -> int:
async with Session() as session:
stmt = select(func.count(self.model.id)).where(self.model.group_id.in_(ids)) stmt = select(func.count(self.model.id)).where(self.model.group_id.in_(ids))
result = await session.execute(stmt) result = await self.db.execute(stmt)
count = result.scalar() count = result.scalar()
return count return count
...@@ -80,7 +79,6 @@ class QuestionDal(DalBase): ...@@ -80,7 +79,6 @@ class QuestionDal(DalBase):
await self.db.execute(sql) await self.db.execute(sql)
class CorrelationDal(DalBase): class CorrelationDal(DalBase):
def __init__(self, db: AsyncSession): def __init__(self, db: AsyncSession):
......
...@@ -36,9 +36,9 @@ class GroupOut(Group): ...@@ -36,9 +36,9 @@ class GroupOut(Group):
class Question(BaseModel): class Question(BaseModel):
title: str title: str | None = None
key_word: str key_word: str | None = None
answer: str answer: str | None = None
group_id: int | None = 0 group_id: int | None = 0
......
...@@ -56,7 +56,7 @@ async def group_del(ids: IdList = Depends(), auth: Auth = Depends(FullAdminAuth( ...@@ -56,7 +56,7 @@ async def group_del(ids: IdList = Depends(), auth: Auth = Depends(FullAdminAuth(
media_counts = await crud.MediaDal(auth.db).get_count_by_groupIds(ids.ids) media_counts = await crud.MediaDal(auth.db).get_count_by_groupIds(ids.ids)
if media_counts > 0: if media_counts > 0:
return ErrorResponse("分组内不为空,无法删除") return ErrorResponse("分组内不为空,无法删除")
# await crud.GroupDal(auth.db).delete_datas(ids.ids, v_soft=True) await crud.GroupDal(auth.db).delete_datas(ids.ids, v_soft=True)
return SuccessResponse("删除成功") return SuccessResponse("删除成功")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment