This commit is contained in:
2026-06-10 18:37:04 +08:00
parent 65235610c5
commit e49b600472
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ async def wechat_callback(request: Request, db: AsyncSession = Depends(get_db)):
return {"code": "SUCCESS", "message": "OK"}
@router.post("/alipay/callback")
@router.get("/alipay/callback")
async def alipay_callback(request: Request, db: AsyncSession = Depends(get_db)):
form_data = await request.form()
data = dict(form_data)
@@ -42,6 +42,11 @@ class RequestEncryptMiddleware(BaseHTTPMiddleware):
async def dispatch(
self, request: Request, call_next: RequestResponseEndpoint
) -> Response:
# 白名单:支付回调接口不需要加密/解密
path = request.url.path
if "/payments/alipay/callback" in path or "/payments/wechat/callback" in path:
return await call_next(request)
encrypted = request.headers.get("X-Encrypted", "").lower() == "true"
if not encrypted:
return await call_next(request)