package stdLog import "fmt" type CodeType int type CodeMsg struct { Code int `json:"code"` Msg string `json:"msg"` Tip string `json:"tip,omitempty"` } // 错误级别 const ( ParamLevel = 10000 // 参数级 StoreLevel = 20000 // 存储级 ServerLevel = 30000 // 服务级 BusinessLevel = 40000 // 业务逻辑级 ) // 通用code const ( Success CodeType = 200 //Success 通用成功 Failure CodeType = 400 //Failure 通用失败 ) const ( ParamError CodeType = ParamLevel + iota // 10000 参数错误 NoToken // 10001 没有token ParamDeductionRatioError // 10002 无效的扣量值 InvalidPhoneNumber // 10003 无效的手机号 QueryError // 10004 查询失败 ) const ( AdminAccountNotExists CodeType = ServerLevel + iota // 30000 管理员账号不存在 AdminPasswordError // 30001 管理员密码错误 AdminGetAuthorityFailed // 30002 获取权限失败 ChannelNotExists // 30003 渠道不存在 AgentAccountNotExists // 30004 代理商账号不存在 AgentPasswordError // 30005 代理商密码错误 AuthorityRoleExists // 30006 该权限角色已存在 AgentHasLocked // 30007 禁止登陆 VerifySmsCodeFailed // 30008 验证码错误 DisableWithdraw // 30009 禁止提现 WithdrawBalanceLess // 30010 提现金额不足 WithdrawFailed // 30011 提现失败 WithdrawHasDone // 30012 提现已经处理 WithdrawRequestFailed // 30013 提现第三方请求失败 WithdrawMobileError // 30014 手机号不一致 NotSupportWithdraw // 30015 不支持提现 AccountExists // 30016 账号已存在 AgentAccountBanned // 30017 账号已禁用 GoogleAuthFailed // 30018 谷歌验证失败 AdvertiseLocExists // 30019 广告位置已存在 AdvertiseInvalid // 30020 无效的广告 AppInfoError // 30021 应用信息错误 InvalidPrice // 30022 无效的金额 ChannelExists // 30023 渠道已存在 ActivityNoExistErr // 30024 活动不存在 LotteryNumReachedTheLimit // 30025 今日抽奖次数达到限制 LotteryCodeIsInvalid // 30026 兑换码无效 LotteryCodeIsUsed // 30026 兑换码已使用 SettlementDouble // 30028 重复结算 DownloadM3u8File // 30029 文件服务器访问失败 DownloadFileError // 30030 文件服务器访问失败 ErrApplicationNotExist // 应用不存在 RedisSet // 设置redis错误 AppDbError // app数据库错误 AppCategoryDbError // appcategory数据库错误 AppExistErr // app不能重复 ApplicationLocExists // 30036 广告位置已存在 ) const ( QueryDataError CodeType = BusinessLevel + iota // 数据查询失败 InsertDataError // 添加数据失败 UpdateDataError // 更新数据失败 DelDataError // 删除数据失败 DataNotExist // 数据不存在 DataEmpty ) func (c CodeType) Error() string { return fmt.Sprintf("code=%d,msg=%v,tip=%v", c, c.Msg(), c.Tip()) }