Merge branch 'main' of gitee.com:wg123/video-gen into main

This commit is contained in:
18610128193
2026-06-10 14:44:35 +08:00
5 changed files with 61 additions and 34 deletions
+28
View File
@@ -412,6 +412,34 @@ async def list_payment_configs(
]
@router.put("/payment-configs/batch")
async def batch_update_payment_configs(
req: dict[str, str],
admin: User = Depends(get_admin_user),
db: AsyncSession = Depends(get_db),
):
"""Batch upsert payment configs. Creates missing keys, updates existing ones."""
from app.utils.id_gen import generate_id
for key, value in req.items():
if not key.startswith("payment_"):
continue
result = await db.execute(
select(SystemConfig).where(SystemConfig.key == key).limit(1)
)
config = result.scalar_one_or_none()
if config:
config.value = value
else:
db.add(SystemConfig(
id=generate_id(),
key=key,
value=value,
))
await db.flush()
return {"ok": True}
@router.put("/payment-configs/{config_id}")
async def update_payment_config(
config_id: str,