From b7cd69c600301de582c8cdbe6cfdc8fd12ea51f2 Mon Sep 17 00:00:00 2001 From: lan Date: Thu, 15 Dec 2022 17:14:39 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=8E=BB=E9=99=A4=E5=8F=96=E4=BB=B6?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E8=BF=87=E6=9C=9F=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/main.py b/main.py index f783b20..5ba4203 100644 --- a/main.py +++ b/main.py @@ -107,11 +107,7 @@ async def index(code: str, ip: str = Depends(error_ip_limit), s: AsyncSession = error_count = settings.ERROR_COUNT - error_ip_limit.add_ip(ip) raise HTTPException(status_code=404, detail=f"取件码错误,{error_count}次后将被禁止{settings.ERROR_MINUTE}分钟") if info.exp_time < datetime.datetime.now() or info.count == 0: - if info.type != "text": - await storage.delete_file(info.text) - await s.delete(info) - await s.commit() - raise HTTPException(status_code=404, detail="取件码已过期,请联系寄件人") + raise HTTPException(status_code=404, detail="取件码已失效,请联系寄件人") await s.execute(update(Codes).where(Codes.id == info.id).values(count=info.count - 1)) await s.commit() if info.type != 'text':