1
This commit is contained in:
@@ -3,7 +3,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||||
from fastapi import HTTPException, Request, Response
|
from fastapi import Request, Response
|
||||||
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
|
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
|
||||||
|
|
||||||
from app.config import settings
|
from app.config import settings
|
||||||
@@ -98,14 +98,6 @@ class RequestEncryptMiddleware(BaseHTTPMiddleware):
|
|||||||
status_code=response.status_code,
|
status_code=response.status_code,
|
||||||
headers={"X-Encrypted": "true", "Content-Type": "application/json"},
|
headers={"X-Encrypted": "true", "Content-Type": "application/json"},
|
||||||
)
|
)
|
||||||
except HTTPException as http_exc:
|
|
||||||
# BaseHTTPMiddleware 中 call_next 抛出的 HTTPException 会直接传播,
|
|
||||||
# 这里捕获后返回对应状态码的响应,避免被外层 except Exception 吞掉
|
|
||||||
return Response(
|
|
||||||
content=json.dumps({"detail": http_exc.detail}, ensure_ascii=False),
|
|
||||||
status_code=http_exc.status_code,
|
|
||||||
headers={"Content-Type": "application/json"},
|
|
||||||
)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Request decryption failed")
|
logger.exception("Request decryption failed")
|
||||||
return Response(
|
return Response(
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ async def create_invoice(
|
|||||||
for o in occupied
|
for o in occupied
|
||||||
)
|
)
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_409_CONFLICT,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail=details,
|
detail=details,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
||||||
<title>民众智创</title>
|
<title>民众智创</title>
|
||||||
<script type="module" crossorigin src="/assets/index-D088jE8K.js"></script>
|
<script type="module" crossorigin src="/assets/index-CFnMIoCK.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DtYH0-uL.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DtYH0-uL.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ const InvoicePage: React.FC = () => {
|
|||||||
endDate: orderDateFilter[1] || undefined,
|
endDate: orderDateFilter[1] || undefined,
|
||||||
});
|
});
|
||||||
const items = data.items || [];
|
const items = data.items || [];
|
||||||
// 后端返回 is_occupied / occupied_by,API 客户端转为 camelCase
|
// 后端已返回 is_occupied 和 occupied_by,直接使用
|
||||||
const markedItems = items.map((o: any) => ({
|
const markedItems = items.map((o: any) => ({
|
||||||
...o,
|
...o,
|
||||||
_occupied: !!o.isOccupied,
|
_occupied: !!o.is_occupied,
|
||||||
_occupiedBy: o.occupiedBy,
|
_occupiedBy: o.occupied_by,
|
||||||
}));
|
}));
|
||||||
setOrderData(markedItems);
|
setOrderData(markedItems);
|
||||||
setOrderTotal(data.total || 0);
|
setOrderTotal(data.total || 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user