44 lines
896 B
Go
44 lines
896 B
Go
|
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,
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|