package com.ruoyi.payment.domain.enums; /** * 客户端类型枚举 * * @author ruoyi */ public enum ClientType { /** 微信Native */ NATIVE("NATIVE", "微信Native"), /** 支付宝当面付 */ ALIPAY_PRECREATE("ALIPAY_PRECREATE", "支付宝当面付"); private final String code; private final String desc; ClientType(String code, String desc) { this.code = code; this.desc = desc; } public String getCode() { return code; } public String getDesc() { return desc; } public static ClientType fromCode(String code) { for (ClientType type : values()) { if (type.code.equals(code)) { return type; } } throw new IllegalArgumentException("未知的客户端类型: " + code); } }