package card import "encoding/json" type Code json.Number const ( CodeSuccess Code = "2000" CodeSuccess2 Code = "0000" ) var ResMessageMap = map[Code]string{ CodeSuccess: "成功", "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) IsSuccess() bool { // 根据沟通对接,两种都是请求成功 return c == CodeSuccess || c == CodeSuccess2 } func (c Code) GetMessage() string { if message, ok := ResMessageMap[c]; ok { return message } return "未知错误,请联系平台" }