39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package card
|
|
|
|
type Code string
|
|
|
|
const CodeSuccess Code = "0000"
|
|
const RechargeCodeSuccess Code = "2000"
|
|
|
|
var ResMessageMap = map[Code]string{
|
|
"1000": "Ip limit(ip未绑定或绑定失败)",
|
|
"1001": "Missing parameters(参数异常)",
|
|
"1002": "Invalid merchant(无效商户信息)",
|
|
"1003": "Invalid signature(签名校验失败)",
|
|
"1004": "Request expiration(请求时间过期)",
|
|
"1005": "Order repeat(订单重复)",
|
|
"1006": "Invalid item(商品未开通)",
|
|
"1007": "Item price invalid(商品价格无效)",
|
|
"1008": "Insufficient Balance(余额不足)",
|
|
"1009": "Interface adjustment(商品映射无效)",
|
|
"1010": "Interface price adjustment(映射价格无效)",
|
|
"1011": "Account format matching(充值账号格式不匹配)",
|
|
"1012": "no order(无订单信息)",
|
|
"1999": "unknown error(异常错误,建议人工处理或查询订单状态)",
|
|
}
|
|
|
|
func (c Code) IsRechargeSuccess() bool {
|
|
return c == RechargeCodeSuccess
|
|
}
|
|
|
|
func (c Code) GetMessage() string {
|
|
if message, ok := ResMessageMap[c]; ok {
|
|
return message
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (c Code) IsSuccess() bool {
|
|
return c == CodeSuccess
|
|
}
|