feat:更新博客访客记录

This commit is contained in:
2025-09-28 18:42:08 +08:00
parent bd1d10e0f7
commit b6617d3db2
4 changed files with 166 additions and 6 deletions

View File

@@ -9,8 +9,9 @@ from middleware.exceptions import AppException
async def blog_visit_middleware(request: Request, call_next):
# 检查路径是否匹配 /blog/content/{blog_id}
if match := re.match(r"^/blog/content/(\d+)$", request.url.path):
# 检查路径是否匹配
if match := re.match(r"^/blog/(\d+)/content$", request.url.path):
# 获取客户端信息
ip = get_client_ip(request)
user_agent = request.headers.get("User-Agent", "")