Prechádzať zdrojové kódy

fix: GENERAL→DEFAULT expense_type 映射

alphah 2 týždňov pred
rodič
commit
042a5f1b24

+ 4 - 0
backend/app/plugin/module_payment/expense/institution/controller.py

@@ -68,6 +68,10 @@ async def create_institution_controller(
     # Alipay 必填:商户外部单据号(唯一标识)
     if not data.get("outer_source_id"):
         data["outer_source_id"] = str(uuid.uuid4()).replace("-", "")
+    # expense_type 映射:前端值 → 支付宝标准值
+    EXPENSE_TYPE_MAP = {"GENERAL": "DEFAULT", "DEFAULT": "DEFAULT"}
+    if data.get("expense_type") in EXPENSE_TYPE_MAP:
+        data["expense_type"] = EXPENSE_TYPE_MAP[data["expense_type"]]
     # 时间格式补全:YYYY-MM-DD → YYYY-MM-DD HH:mm:ss
     if data.get("effective_start_date") and len(data["effective_start_date"]) == 10:
         data["effective_start_date"] = data["effective_start_date"] + " 00:00:00"