package errorcode const ( //成功 Success = 200 //参数错误 ParamError = 400 //未经授权 NotAuth = 401 //请求被禁止 Forbidden = 403 //找不到页面 NotFound = 404 //系统错误 SystemError = 500 //请求超时 RequestTimeOut = 600 //未登录 NotLogin = 1000 // 商户 MerchantNotFound = 1100 // app AppNotFound = 1200 AppDisabled = 1201 AppIpNotAllow = 1202 AppRsaDecryptKeyNotFound = 1203 AppDecryptDataDiscrepancy = 1204 AppNotifyUrlNotFound = 1205 AppIdNotSet = 1206 InvalidAppIdType = 1207 AppRsaDecryptFail = 1210 AppRsaEncryptKeyNotFound = 1211 AppRsaEncryptFail = 1212 AppSM2DecryptKeyNotFound = 1220 AppSM2DecryptFail = 1221 AppSM2EncryptKeyNotFound = 1222 AppSM2EncryptFail = 1223 AppSM4DecryptKeyNotFound = 1230 AppSM4DecryptFail = 1231 AppSM4EncryptKeyNotFound = 1232 AppSM4EncryptFail = 1233 AppAesEncryptFail = 1234 AppDeEncryptFail = 1250 // 加密方式不存在 EncryptTypeNotFound = 1241 PayChannelConfigNotFound = 1242 // 加密参数异常 PayEncryptParamFail = 1243 //渠道 PayChannelNotFound = 1300 PayChannelNotBuild = 1301 PayChannelExtJsonError = 1302 //订单 OrdersNotFound = 1401 OrdersExist = 1402 OrderTypeNotFount = 1403 OrderIsDelete = 1405 OrderStatusErr = 1406 OrderClosed = 1407 OrderFailed = 1408 OrderPayed = 1409 RefundOrderNotFound = 1410 OrderStatusRefundNotSupport = 1411 OrderAppidNotEqRefundAppid = 1412 OrderNotSupportRefundPart = 1413 OrderRefundAmountError = 1414 OrderPayChannelChange = 1415 OrderPayRequestLogNotExist = 1416 // 关闭订单 CloseOrderPayed = 1420 //请求日志 RequestLogErrors = 1500 RequestLogNotFound = 1501 RequestResponseValid = 1502 //回调 NotifySendFail = 1600 //订单结果 PrePayFail = 1701 PreRefundFail = 1702 ThirdRefundFail = 1710 // 退款 RefundOutTradeNoSame = 1801 // 微信授权 WechatAuthFail = 1901 WechatAuthSignFail = 1902 ) var MsgEN = map[int]string{ Success: "success", ParamError: "param error", NotAuth: "not authorized", Forbidden: "forbidden", NotFound: "not found", SystemError: "system error", } var MsgZH = map[int]string{ Success: "请求成功", ParamError: "参数错误", NotFound: "数据不存在", NotAuth: "未经授权", NotLogin: "未登录", RequestTimeOut: "请求超时", MerchantNotFound: "商户不存在", AppNotFound: "app_id未找到", AppDisabled: "app通道关闭", AppIpNotAllow: "ip不在白名单内", AppDecryptDataDiscrepancy: "解密数据不一致", SystemError: "系统错误", AppNotifyUrlNotFound: "未设置回调地址", AppIdNotSet: "appId未设置", InvalidAppIdType: "无效的app_id类型", AppRsaDecryptKeyNotFound: "密匙缺失,无法进行Rsa解密", AppRsaDecryptFail: "Rsa解密失败", AppRsaEncryptKeyNotFound: "密匙缺失,无法进行Rsa加密", AppRsaEncryptFail: "Rsa加密失败", AppSM2DecryptKeyNotFound: "密匙缺失,无法进行sm2解密", AppSM2DecryptFail: "sm2解密失败", AppSM2EncryptKeyNotFound: "密匙缺失,无法进行sm2加密", AppSM2EncryptFail: "sm2加密失败", AppSM4DecryptKeyNotFound: "密匙缺失,无法进行sm4解密", AppSM4DecryptFail: "sm4解密失败", AppSM4EncryptKeyNotFound: "密匙缺失,无法进行sm4加密", AppSM4EncryptFail: "sm4加密失败", AppAesEncryptFail: "aes 加密失败", EncryptTypeNotFound: "加密方式不存在", PayChannelConfigNotFound: "secret支付方式配置不存在", PayEncryptParamFail: "加密参数错误,解析失败", AppDeEncryptFail: "未知原因导致解密失败,请检查加密数据是和app加密配置", PayChannelNotFound: "支付方式不存在", PayChannelNotBuild: "支付方式尚未开通", PayChannelExtJsonError: "支付方式扩展参数错误", RequestLogErrors: "请求日志错误", RequestLogNotFound: "未找到日志信息", RequestResponseValid: "上游返回格式无效", OrdersNotFound: "未找到订单", OrdersExist: "订单已存在", OrderTypeNotFount: "未知的支付方式", OrderIsDelete: "订单已删除", OrderStatusErr: "订单状态错误", OrderClosed: "订单已关闭,无法继续支付", OrderFailed: "订单支付失败,请重新发起", OrderPayed: "订单已支付成功,请勿重复支付", OrderPayChannelChange: "支付方式不一致,切换支付方式请关闭原订单生成新订单", OrderPayRequestLogNotExist: "订单下单数据不存在", NotifySendFail: "回调发送失败", RefundOrderNotFound: "退款订单未找到", OrderStatusRefundNotSupport: "订单状态不支持退款", OrderAppidNotEqRefundAppid: "订单app_id与退款订单app_id不一致", PrePayFail: "预支付失败", PreRefundFail: "创建退款单失败", OrderNotSupportRefundPart: "订单暂不支持部分退款", OrderRefundAmountError: "退款金额错误", RefundOutTradeNoSame: "支付商户单号和退款商户单号不能相同", CloseOrderPayed: "订单已支付成功,无法关闭", ThirdRefundFail: "第三方退款失败", WechatAuthFail: "微信授权失败", WechatAuthSignFail: "微信签名失败", } var MsgMap map[string]map[int]string = map[string]map[int]string{"en": MsgZH} func GetMsg(code int, local string) string { if local == "" { local = "en" } if msg, ok := MsgMap[local][code]; ok { return msg } return "" }