Przeglądaj źródła

卡片打分融合图修改

袁威 2 tygodni temu
rodzic
commit
56eb7038d2
1 zmienionych plików z 10 dodań i 1 usunięć
  1. 10 1
      app/api/formate_xy.py

+ 10 - 1
app/api/formate_xy.py

@@ -270,7 +270,16 @@ async def update_image_modified_json(
         card_id_to_update = row["card_id"]
         check_card_permission(db_conn, current_user, card_id_to_update)
         image_type = row["image_type"]
-        score_type = IMAGE_TYPE_TO_SCORE_TYPE.get(image_type)
+        
+        # 针对融合图,在调用外部服务算分时直接把它当成对应的 ring 图
+        # 否则它在映射表里是 None,会导致报错
+        target_score_type = image_type
+        if image_type == ImageType.front_fusion.value:
+            target_score_type = ImageType.front_ring.value
+        elif image_type == ImageType.back_fusion.value:
+            target_score_type = ImageType.back_ring.value
+            
+        score_type = IMAGE_TYPE_TO_SCORE_TYPE.get(target_score_type)
         if not score_type:
             raise HTTPException(status_code=400, detail=f"未知的 image_type: {image_type}")