2024-06-17 14:18:39 +08:00
|
|
|
package errorcode
|
|
|
|
|
|
|
|
const (
|
2024-06-25 10:12:48 +08:00
|
|
|
//请求失败
|
|
|
|
Fail = 0
|
2024-06-17 14:18:39 +08:00
|
|
|
//成功
|
|
|
|
Success = 200
|
|
|
|
|
|
|
|
//参数错误
|
|
|
|
ParamError = 400
|
|
|
|
|
|
|
|
//未经授权
|
|
|
|
NotAuth = 401
|
|
|
|
|
|
|
|
//请求被禁止
|
|
|
|
Forbidden = 403
|
|
|
|
|
|
|
|
//找不到页面
|
|
|
|
NotFound = 404
|
|
|
|
|
|
|
|
//系统错误
|
|
|
|
SystemError = 500
|
|
|
|
|
|
|
|
//未登录
|
|
|
|
NotLogin = 1000
|
2024-06-19 18:32:34 +08:00
|
|
|
|
|
|
|
//抽奖中
|
|
|
|
OrderLottery = 1001
|
|
|
|
//商品不存在
|
|
|
|
OrderProductNotExist = 1002
|
|
|
|
//兴业下单失败
|
|
|
|
XINYEOrderFAIL = 1003
|
2024-06-24 11:44:38 +08:00
|
|
|
//商品库存不足
|
|
|
|
ProductStockFAIL = 1004
|
2024-06-19 18:32:34 +08:00
|
|
|
|
|
|
|
//订单不允许退款
|
|
|
|
OrderNOTAuthREFUND = 2001
|
|
|
|
// 订单更新失败
|
|
|
|
OrderRefundUpdateFail = 2002
|
|
|
|
//退款失败
|
|
|
|
OrderRefundFail = 2003
|
|
|
|
//邮储服务异常
|
|
|
|
YouChuOrderRefundFail = 2004
|
2024-06-25 18:31:16 +08:00
|
|
|
//用户不存在
|
|
|
|
UserNotExist = 2005
|
2024-06-25 10:12:48 +08:00
|
|
|
|
|
|
|
// 更新失败
|
|
|
|
InsertUserFail = 3001
|
|
|
|
//邮储code解析失败
|
|
|
|
YouChuCodeFail = 4001
|
2024-06-25 13:51:22 +08:00
|
|
|
//客户号为空
|
|
|
|
YouChuCustNoEmpty = 4002
|
2024-06-17 14:18:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
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{
|
2024-06-19 18:32:34 +08:00
|
|
|
SystemError: "系统错误",
|
|
|
|
Success: "请求成功",
|
|
|
|
ParamError: "参数错误",
|
|
|
|
NotFound: "数据不存在",
|
|
|
|
NotAuth: "未经授权",
|
|
|
|
NotLogin: "未登录",
|
|
|
|
OrderLottery: "兑换中",
|
|
|
|
OrderProductNotExist: "商品不存在",
|
|
|
|
XINYEOrderFAIL: "三方下单失败",
|
|
|
|
OrderNOTAuthREFUND: "该订单暂不支持退款",
|
|
|
|
OrderRefundUpdateFail: "订单更新失败",
|
|
|
|
OrderRefundFail: "退款失败",
|
|
|
|
YouChuOrderRefundFail: "邮储服务异常",
|
2024-06-24 11:44:38 +08:00
|
|
|
ProductStockFAIL: "库存不足",
|
2024-06-25 10:12:48 +08:00
|
|
|
InsertUserFail: "用户新增失败",
|
2024-06-25 18:31:16 +08:00
|
|
|
UserNotExist: "用户不存在",
|
2024-06-25 10:12:48 +08:00
|
|
|
Fail: "请求失败",
|
|
|
|
YouChuCodeFail: "Code解析失败",
|
2024-06-25 13:51:22 +08:00
|
|
|
YouChuCustNoEmpty: "客户编号为空",
|
2024-06-17 14:18:39 +08:00
|
|
|
}
|
|
|
|
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 ""
|
|
|
|
}
|