From 11855b8db0283c734458dcb65a937e052ad12c9a Mon Sep 17 00:00:00 2001 From: lan-air Date: Sun, 11 Dec 2022 14:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=9C=9F=E5=AE=9E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 64723a1..60fe851 100644 --- a/main.py +++ b/main.py @@ -137,14 +137,14 @@ def ip_error(ip): return ip_info['count'] -@app.get('/file') +@app.get('/select') async def get_file(code: str, db: Session = Depends(get_db)): file = db.query(database.Codes).filter(database.Codes.code == code).first() if file: if file.type == 'text': return {'code': code, 'msg': '查询成功', 'data': file.text} else: - return FileResponse('.' + file.text) + return FileResponse('.' + file.text, filename=file.name) else: return {'code': 404, 'msg': '口令不存在'} @@ -165,7 +165,7 @@ async def index(request: Request, code: str, db: Session = Depends(get_db)): info.count -= 1 db.commit() if info.type != 'text': - info.text = f'/file?code={code}' + info.text = f'/select?code={code}' return { 'code': 200, 'msg': '取件成功,请点击"取"查看',