package card import ( "gitea.cdlsxd.cn/sdk/plugin/proto" ) type OrderStatus string const ( OrderSuccess OrderStatus = "01" // 充值成功 OrderPending OrderStatus = "02" // 充值处理中 OrderFail OrderStatus = "03" // 充值失败 OrderAbnormal OrderStatus = "04" // 充值异常,处理中 ) var orderStatusMap = map[OrderStatus]proto.Status{ OrderSuccess: proto.Status_SUCCESS, OrderPending: proto.Status_ING, OrderFail: proto.Status_FAIL, } var orderStatusTextMap = map[OrderStatus]string{ OrderSuccess: "充值成功", OrderPending: "充值处理中", OrderFail: "充值失败", OrderAbnormal: "充值异常,处理中", } func (o OrderStatus) IsSuccess() bool { return o == OrderSuccess } func (o OrderStatus) IsPending() bool { return o == OrderPending } func (o OrderStatus) IsFail() bool { return o == OrderFail } func (o OrderStatus) IsAbnormal() bool { return o == OrderAbnormal } func (o OrderStatus) GetOrderStatus() proto.Status { if resultStatus, ok := orderStatusMap[o]; ok { return resultStatus } return proto.Status_ING } func (o OrderStatus) GetOrderStatusText() string { if text, ok := orderStatusTextMap[o]; ok { return text } return "" }