Jelajahi Sumber

fix: 不依赖frontend传period_type,直接匹配QUOTA_*因子

alphah 1 Minggu lalu
induk
melakukan
c18d32700d

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

@@ -400,13 +400,11 @@ async def modify_institution_controller(
                         cond_factor = getattr(cond, 'rule_factor', None) or (cond.get("rule_factor") if isinstance(cond, dict) else "")
                         cond_id = getattr(cond, 'rule_id', None) or (cond.get("rule_id") if isinstance(cond, dict) else "")
 
-                        PERIOD_FACTOR_MAP = {"daily": "QUOTA_DAY", "weekly": "QUOTA_WEEK", "monthly": "QUOTA_MONTH", "quarterly": "QUOTA_QUARTER", "yearly": "QUOTA_YEAR"}
+                        PERIOD_FACTORS = {"QUOTA_DAY", "QUOTA_WEEK", "QUOTA_MONTH", "QUOTA_QUARTER", "QUOTA_YEAR"}
 
-                        # 周期限额变更
-                        if grant_mode == "period" and period_type and new_amount is not None:
-                            target_factor = PERIOD_FACTOR_MAP.get(period_type)
-                            if target_factor and cond_factor == target_factor:
-                                modify_condition_list.append({"rule_id": cond_id, "rule_factor": cond_factor, "rule_value": str(new_amount)})
+                        # 周期限额变更(匹配所有 QUOTA_* 因子)
+                        if grant_mode == "period" and new_amount is not None and cond_factor in PERIOD_FACTORS:
+                            modify_condition_list.append({"rule_id": cond_id, "rule_factor": cond_factor, "rule_value": str(new_amount)})
 
                         # 单笔限额变更
                         if cond_factor == "QUOTA_TOTAL" and new_single_limit is not None: