update:update default banner img by @yanyuo

This commit is contained in:
lan
2023-01-14 15:51:13 +08:00
parent 90996f3b88
commit 82b4b019f9
3 changed files with 3 additions and 6 deletions
+2 -4
View File
@@ -5,7 +5,6 @@ from pathlib import Path
import os
try:
import chardet
from fastapi import FastAPI, Depends, UploadFile, Form, File, HTTPException, BackgroundTasks
from starlette.requests import Request
from starlette.responses import HTMLResponse, FileResponse
@@ -14,7 +13,6 @@ try:
from sqlalchemy.ext.asyncio.session import AsyncSession
except ImportError:
os.system("pip install -r requirements.txt")
import chardet
from fastapi import FastAPI, Depends, UploadFile, Form, File, HTTPException, BackgroundTasks
from starlette.requests import Request
from starlette.responses import HTMLResponse, FileResponse
@@ -80,8 +78,8 @@ async def admin_post(page: int = Form(default=1), size: int = Form(default=10),
async def admin_patch(request: Request, s: AsyncSession = Depends(get_session)):
# 从数据库获取系统配置
# 如果不存在config这个key,就创建一个
config = (await s.execute(select(Values).filter(Values.key == 'config'))).scalar_one_or_none()
if not config:
value = (await s.execute(select(Values).filter(Values.key == 'config'))).scalar_one_or_none()
if not value:
s.add(Values(key='config', value=await request.json()))
else:
await s.execute(update(Values).where(Values.key == 'config').values(value=await request.json()))
-1
View File
@@ -5,4 +5,3 @@ python-multipart==0.0.5
uvicorn==0.15.0
greenlet==2.0.1
starlette~=0.22.0
chardet == 5.1.0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 498 KiB