Browse Source

fix: handleMessage中notifyType使用NotifyType枚举替换魔法字符串

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 2 tuần trước cách đây
mục cha
commit
ac8581aed0

+ 14 - 9
haha-service/src/main/java/com/haha/service/impl/HahaCallbackServiceImpl.java

@@ -9,6 +9,7 @@ import com.haha.common.enums.ApplyScopeEnum;
 import com.haha.common.enums.CouponTypeEnum;
 import com.haha.common.enums.DeviceDoorStatus;
 import com.haha.common.enums.DeviceOnlineStatus;
+import com.haha.common.enums.NotifyType;
 import com.haha.common.enums.OpenType;
 import com.haha.common.enums.PayScoreState;
 import com.haha.common.enums.PaymentChannel;
@@ -112,27 +113,31 @@ public class HahaCallbackServiceImpl implements HahaCallbackService {
             return;
         }
 
-        switch (notifyType) {
-            case "DEVICE_STATUS":
+        NotifyType type = NotifyType.fromCode(notifyType);
+        if (type == null) {
+            log.warn("未知的消息通知类型: {}", notifyType);
+            return;
+        }
+
+        switch (type) {
+            case DEVICE_STATUS:
                 handleDeviceStatus(params);
                 break;
-            case "ONLINE_STATUS":
+            case ONLINE_STATUS:
                 handleOnlineStatus(params);
                 break;
-            case "VOICE_RESULT":
+            case VOICE_RESULT:
                 handleVoiceResult(params);
                 break;
-            case "CLIENT_NEW_PRODUCT":
+            case CLIENT_NEW_PRODUCT:
                 handleNewProductAudit(params);
                 break;
-            case "MERGE_PRODUCT":
+            case MERGE_PRODUCT:
                 handleMergeProduct(params);
                 break;
-            case "ORC_RESULT":
+            case ORC_RESULT:
                 handleOrcResult(params);
                 break;
-            default:
-                log.warn("未知的消息通知类型: {}", notifyType);
         }
     }