package consts import "github.com/go-redis/redis/v8" var RedisNil = redis.Nil var errorCodeToastMap = map[int32]string{} const DefaultToast = "" const ErrorSuccess int32 = 20000 const ErrorNotLogin int32 = 44000 const ErrorParamCheck int32 = 40000 const ErrorInternal int32 = 40000 func init() { errorCodeToastMap[ErrorSuccess] = "请求成功" errorCodeToastMap[ErrorNotLogin] = "请登录后操作" errorCodeToastMap[ErrorParamCheck] = "error" errorCodeToastMap[ErrorInternal] = "网络错误" } func GetErrorToast(errorCode int32) string { toast, contain := errorCodeToastMap[errorCode] if contain { return toast } return "网络错误,请稍后再试" }