package com.jxy.order.enums;

/**
 * 订单状态
 */
public enum ConsumeStatus {
    /**
     * 2支付待确认
     * 1支付成功
     * 0支付失败
     */

    PAY_OFF(2, "消费订单待确认"),
    SUCCESS(1, "成功"),
    PAY_FAIL(0, "失败");

    private final int code;
    private final String status;

    ConsumeStatus(int code, String status)
    {
        this.code = code;
        this.status = status;
    }

    public int getCode() {
        return code;
    }

    public String getStatus() {
        return status;
    }

    public static String getStatusByCode(int code){
        for (ConsumeStatus u : ConsumeStatus.values()) {
            if(u.getCode()==code){
                return u.getStatus();
            }
        }
        return "";
    }
}
