109 lines
2.5 KiB
Go
109 lines
2.5 KiB
Go
package errorcode
|
||
|
||
const (
|
||
//成功
|
||
Success = 200
|
||
|
||
//参数错误
|
||
ParamError = 400
|
||
|
||
//未经授权
|
||
NotAuth = 401
|
||
|
||
//请求被禁止
|
||
Forbidden = 403
|
||
|
||
//找不到页面
|
||
NotFound = 404
|
||
|
||
//系统错误
|
||
SystemError = 500
|
||
|
||
//请求超时
|
||
RequestTimeOut = 600
|
||
|
||
//未登录
|
||
NotLogin = 1000
|
||
|
||
// 商户
|
||
MerchantNotFound = 1100
|
||
|
||
// app
|
||
<<<<<<< HEAD
|
||
AppNotFound = 1200
|
||
AppDisabled = 1201
|
||
AppIpNotAllow = 1202
|
||
AppRsaDecryptKeyNotFound = 1300
|
||
AppRsaDecryptFail = 1301
|
||
AppRsaEncryptKeyNotFound = 1302
|
||
AppRsaEncryptFail = 1303
|
||
AppSM2DecryptKeyNotFound = 1310
|
||
AppSM2DecryptFail = 1311
|
||
AppSM2EncryptKeyNotFound = 1312
|
||
AppSM2EncryptFail = 1313
|
||
AppSM4DecryptKeyNotFound = 1320
|
||
AppSM4DecryptFail = 1321
|
||
AppSM4EncryptKeyNotFound = 1322
|
||
AppSM4EncryptFail = 1323
|
||
=======
|
||
AppNotFound = 1200
|
||
AppDisabled = 1201
|
||
AppIpNotAllow = 1202
|
||
|
||
//渠道
|
||
PayChannelNotFound = 1300
|
||
>>>>>>> dev/dev1.0
|
||
)
|
||
|
||
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不在白名单内",
|
||
<<<<<<< HEAD
|
||
|
||
AppRsaDecryptKeyNotFound: "密匙缺失,无法进行Rsa解密",
|
||
AppRsaDecryptFail: "Rsa解密失败",
|
||
AppRsaEncryptKeyNotFound: "密匙缺失,无法进行Rsa加密",
|
||
AppRsaEncryptFail: "Rsa加密失败",
|
||
|
||
AppSM2DecryptKeyNotFound: "密匙缺失,无法进行sm2解密",
|
||
AppSM2DecryptFail: "sm2解密失败",
|
||
AppSM2EncryptKeyNotFound: "密匙缺失,无法进行sm2加密",
|
||
AppSM2EncryptFail: "sm2加密失败",
|
||
|
||
AppSM4DecryptKeyNotFound: "密匙缺失,无法进行sm4解密",
|
||
AppSM4DecryptFail: "sm4解密失败",
|
||
AppSM4EncryptKeyNotFound: "密匙缺失,无法进行sm4加密",
|
||
AppSM4EncryptFail: "sm4加密失败",
|
||
=======
|
||
PayChannelNotFound: "支付方式不存在",
|
||
>>>>>>> dev/dev1.0
|
||
}
|
||
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 ""
|
||
}
|