From 7de12a052e67906831556c82ea693a6973a10978 Mon Sep 17 00:00:00 2001 From: panda <7934952@qq.com> Date: Mon, 19 Aug 2024 17:02:55 +0800 Subject: [PATCH] add new --- internal/models.py | 2 +- routers/commentmanage.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/models.py b/internal/models.py index 7cccda9..59732c1 100644 --- a/internal/models.py +++ b/internal/models.py @@ -140,7 +140,7 @@ class Comment(BaseModel): commentname:Annotated[str,Field( title="评论用户", description="评论用户不允许为空" - )] + )]=None email:Annotated[str,Field( title="评论用户邮箱", description="评论用户邮箱不允许为空" diff --git a/routers/commentmanage.py b/routers/commentmanage.py index 9db782c..eac1b0e 100644 --- a/routers/commentmanage.py +++ b/routers/commentmanage.py @@ -11,9 +11,9 @@ router = APIRouter( # 新增 @router.post("/add") -@limiter.limit("10/minute") +@limiter.limit("1/minute") async def comment_add(request: Request,comment:Comment): - insert_query="""INSERT INTO comments (parent_id,blog_id,commentname,email,commenturl,commentcontent) VALUES(%s,%s,%s,%s)""" + insert_query="""INSERT INTO comments (parent_id,blog_id,commentname,email,commenturl,commentcontent) VALUES(%s,%s,%s,%s,%s,%s)""" insert_value=(comment.parent_id,comment.blog_id,comment.commentname,comment.email,comment.commenturl,comment.commentcontent) execute_query(insert_query,insert_value) return response_success(data=comment,message="comment create success")