Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+421
View File
@@ -0,0 +1,421 @@
package stderr
// 通用code
const (
Success Code = 200 //Success 通用成功
Failure Code = 400 //Failure 通用失败
FunctionNotEnabled Code = 404 //FunctionNotEnabled 功能未开启
FunctionUpgrade Code = 405 //FunctionUpgrade 功能维护升级
FunctionUpgradeToLatest Code = 408 //FunctionUpgradeToLatest 功能已升级,请重新下载最新版本安装使用
)
const (
_ Code = -1 * (iota + 1)
ErrUnrecognized //ErrUnrecognized 未知错误 -1
MustSliceOrSlicePtr //必须要是切片或切片指针 -2
UserIsNotExists //用户不存在 -3
SignFailedToVerify //签名校验不通过 -4
UserIsException //用户异常 -5
BadUA // UA 异常
UserIsNotMerchant //用户不是商家
UserActiveNotEnough // 用户活跃值不足
)
const (
ErrDownloadError Code = -1 * (iota + 1000) //ErrDownloadError 下载文件失败 -1000
ErrUploadError //ErrUploadError 上传文件失败 -1001
ErrFsBucketNotExist //ErrFsBucketNotExist ErrFsBucketNotExist -1002
UpLoadingFile //UpLoadingFile UpLoadingFile -1003
ErrFsOptionWrong //ErrFsOptionWrong ErrFsOptionWrong -1004
ErrExportFileFail //ErrExportFileFail ErrExportFileFail -1005
FileMerging //FileMerging 文件合并中 -1006
FileConverting //FileConverting 文件转换中 -1007
UploadLoadingToFs //UploadLoadingToFs 文件正在上传到FS服务器 -1008
ErrConnectToFs //ErrConnectToFs 连接文件服务器失败 -1009
CodeEmptyData //CodeEmptyData 空数据 -1010
ErrMimeType //ErrMimeType 不支持的文件格式 -1011
ErrFsServerFile //ErrFsServerFile 文件服务异常 -1012
ErrMergeFile //ErrMergeFile 文件合并失败 -1013
ErrConvertFile //ErrConvertFile 文件转码失败 -1014
ErrPlayTimeTooShort //ErrPlayTimeTooShort 上传的视频播放时间太短 -1015
ErrUploadExistVideo //ErrUploadExistVideo 重复上传视频 -1016
ForbidUploadVideo //ForbidUploadVideo 该用户已经禁止上传文件 -1017
UpLoadFileComplete Code = 2000 //UpLoadFileComplete UpLoadFileComplete 2000
ResolutionNotEnough Code = 2001 //分辨率不足
)
const (
ErrAccessForbid Code = iota + 1000 //ErrAccessForbid 没有访问权限 1000
ErrNamePwdIncorrect //ErrNamePwdIncorrect 用户名或密码错误 1001
ErrAuthExpired //ErrAuthExpired 证书过期 1002
ErrAuthInvalid //ErrAuthInvalid 无效签名 1003
ErrUserBeBanned //ErrUserBeBanned 用户已经禁言 1004
ErrCustomerBanned //ErrCustomerBanned 客服已休息 1005
ErrVersionUpdate //ErrVersionUpdate 版本强制更新 1006
ErrVersionRange //ErrVersionRange 版本更新范围错误 1007
ErrVersionTooLow //ErrVersionTooLow 指定升级版本太低
)
const (
ErrLoginExpired Code = iota + 4000 //ErrLoginExpired 登陆过期 4000
ErrParamError //ErrParamError 参数参数错误 4001
_ //此错误吗暂未使用 4002
ErrReqForbidden //ErrReqForbidden 请求被拒绝 4003
ErrPathNotFount //ErrPathNotFount 请求路径不存在 4004
ErrMethodIncorrect //ErrMethodIncorrect 请求方法错误 4005
ErrTimeout //ErrTimeout 服务超时 4006
ErrLoginTooFrequently //ErrLoginTooFrequently 4007
ErrNetWorkBusy //ErrNetWorkBusy 网络环境不好 4008
ErrInvalidRequest //ErrInvalidRequest 无效请求 4009
ErrInvalidRequestReplayAttack //ErrInvalidRequestReplayAttack 重放攻击 4010
ErrInterServerError //ErrInterServerError 内部错误
ErrTimeIsEmpty
ErrTimeWithinWeek
)
const (
ErrServerUnavailable Code = iota + 5000 //ErrServerUnavailable 服务不可用 5000
ErrDbQueryError //ErrDbQueryError 数据库查询错误 5001
ErrDbInsertError //ErrDbInsertError 数据库插入错误 5002
ErrDbUpdateError //ErrDbUpdateError 数据库修改错误 5003
ErrDbDeleteError //ErrDbDeleteError 数据库删除错误 5004
ErrNoToken //ErrNoToken 没有token 5005
ErrCaptcha //ErrCaptcha 5006
ErrCaptchaExists //ErrCaptchaExists 5007
ErrSmsSendFail //短信发送失败 5008
InvalidToken //无效token 5009
ErrDbTransError //ErrDbTransError 事务失败 5010
ErrDbInputExist //ErrDbInputExist 数据库输入值已经存在 5011
ErrLoginMobileNotExist //ErrLoginMobileNotExist 用手机登陆,手机号不存在 5012
ErrMobileHasBind //ErrMobileHasBind 已经绑定了该手机号 5013
ErrDeviceIdAndMobileNil //ErrDeviceIdAndMobileNil devId和手机号不存在 5014
ErrUserNameTooLong //ErrUserNameTooLong 用户名称太长 5015
ErrMobileHasBindByOther //ErrMobileHasBindByOther 该手机号已经被使用 5016
ErrMobileInvalid //ErrMobileInvalid 手机号不合法 5017
ErrTokenIsNotExist //ErrTokenIsNotExist token token不存在 5018
ErrCaptchaInvalid //ErrCaptchaInvalid 验证码不正确 5019
ErrWithDrawAccountHasBind //ErrWithDrawAccountHasBind 提现账号已经绑定 5020
ErrQrInvalid //ErrQrInvalid 无效的二维码 5021
ErrBadDevID //ErrBadDevID 错误的设备ID 5022 Since 3.6.0
ErrDbInsertManyError //ErrDbInsertManyError 数据库批量插入错误 5023
ErrInvalidEmail // 无效邮箱
ErrNotSupportedCaptcha // 验证码发送方式不支持
ErrEmailHasBinded // 邮箱已经绑定
ErrEmailBindedByOther // 邮箱已被其他uid的用户使用
ErrAccountHasBinded // 账号已经绑定
ErrAccountBindedByOther // 账号已被他人使用
ErrAccountHasIllegalContent // 账号有非法内容
ErrInvalidAccount // 账号无效
ErrDbTooMuchRecords // 单词查询数据量太大
AdvanceOrderStatusIsErr // 预售订单异常
AdvanceOrderPayTimeIsErr // 预售订单支付时间异常
ErrDataInvalid // 数据不合法
)
const (
CommentErrSendFail Code = iota + 7000 // 评论发送失败 7000
CommentErrGetDataFail // 评论数据获取失败 7001
CommentErrIncCountFailed // 评论增加数量失败 7002
CommentErrDecCountFailed // 评论减少数量失败 7003
CommentErrVideoIsInvalid // 当前视频不可评论 7004
CommentUserHasBanned // 用户已经被禁言 7005
CommentUserNotBind // 用户还未绑定 7006
CommentPublishTooFrequent // 发言太频繁 7007
CommentUserInfoErr // 用户信息错误 7008
CommentVideoInfoErr // 用户信息错误 7009
CommentNotVip // 非vip用户 7010
CommentCountOverLimit // 评论超过限制 7011
CommentNotRchg // 非充值用户用户 7012
CommentOnlyMerchant // 该商家已开启禁止评论权限
UserHasDoTask // 用户已领取过任务
UserHasReceivedIntegral // 用户已领取积分
CommentOneMinuteOverLimit // 每分钟评论超过限制
DownloadCountIsNotEnough // 用户下载次数足
BatchAuditLengthTooLong // 批审核长度过长
)
const (
InsufficientBalance Code = iota + 8000 //InsufficientBalance 余额不足 8000
RechargeFaile //充值第三方错误 8001
InvalidBankCard //InvalidBankCard 8002
UnkonwErr //UnkonwErr 8003
InvalidProduct //InvalidProduct 8004
RepeatPurchase //RepeatPurchase 重复购买 8005
PayBusy //PayBusy 支付繁忙 8006
BuyFailed //BuyFailed 购买失败 8007
RepeatSubmitOrder //RepeatSubmitOrder 订单重复提交
CanNotTransfer //RepeatSubmitOrder 订单重复提交
DifferentBankActName //与上次提现成功不一样的姓名
GoldVideoCoupleNotExist //GoldVideoCoupleNotExist 金币视频抵用券不存在
GoldVideoCoupleAmountErr //GoldVideoCoupleAmountErr 金币视频抵用券面值必须大于视频金额
WithdrawBusy //提现操作繁忙,同一用户短时间内多次提交 8013
WithDrawIllegalAmount //提现金额不满足要求 8014
GetLikesBusy //获取“喜欢”列表过快 8015
GetBuyVidBusy //获取已购列表过快
InsufficientIntegral //InsufficientIntegral 积分不足 8000
OrganizeInsufficientIntegral //OrganizeInsufficientIntegral 积分不足 8000
)
const (
AdminIsNotExist Code = iota + 9000 //AdminIsNotExist 9000
AdminIDErr //AdminIDErr 9001
AdminRefreshTokenErr //AdminRefreshTokenErr 9002
AdminIsHasLockedErr //管理员被封禁 9003
LiaoBaTopOverLimit //撩吧置顶超出10条,请先删除多余置顶帖子 9004
ModuleConfLimitExceed //模块下专题数量超过限制 9005
NoSelfAddMsg // 不能给自己发消息
)
const (
DistrictActErr Code = iota + 21001 //DistrictActErr 21001
DistrictRefreshTokenErr //DistrictRefreshTokenErr 21002
DistrictAgentNotBind //DistrictAgentNotBind 21003
UserNotDistrictAgent //UserNotDistrictAgent 21004
DistrictActIsNotExist //DistrictActIsNotExist 21005
AgentNotInvitedUID //AgentNotInvitedUID 21006
DiscNameExists //DiscNameExists 21007
DistrictInsufficientBalance //DistrictInsufficientBalance 21008
DistrictWithdrawAmountTooLittleError //DistrictWithdrawAmountTooLittleError 21009
DistrictWithdrawAmountTooMuchError //DistrictWithdrawAmountTooMuchError 21010
DistrictWithdrawMethodInvalidError //DistrictWithdrawMethodInvalidError 21011
DistrictWithdrawFailed //DistrictWithdrawFailed 21012
DistrictWithdrawTooFast //DistrictWithdrawTooFast 21013
DistrictPasswordError //DistrictPasswordError 21014
DistrictMobileHasBinded //DistrictMobileHasBinded 21005
DistrictNotHaveMobile //DistrictNotHaveMobile 21006
DistrictTimeOutOfRange7 //DistrictTimeOutOfRange7 21007
DistrictLessThanDividendRatio //DistrictLessThanDividendRatio 21007
DistrictTypeIsNotExist //DistrictTypeIsNotExist 21008
DistrictDedTypeIsNotExist //DistrictDedTypeIsNotExist 21009
DistrictConDedSetIsNotComplete //DistrictConDedSetIsNotComplete 21010
DistrictNUDedSetIsNotComplete //DistrictNUDedSetIsNotComplete 21010
DistrictCodeTooLong //DistrictCodeTooLong 21010
DiscCodeExists //DiscCodeExists 21011
DiscOptDividendRatioIsNotExist //DiscOptDividendRatioIsNotExist 21012
DiscDividendRatioIsNotExist //DiscOptDividendRatioIsNotExist 21012
DiscAuthInUsing //AuthInUsing 21013
DiscAuthIsNotExist //AuthIsNotExist 21014
DistrictDividendBreakdown //DistrictDividendBreakdown 21015
DistrictRoleIsNotExist //DistrictRoleIsNotExist 21016
DistrictCPACantAddCPS //DistrictCPACantAddCPS 21017
DistrictAddAuthFailed //DistrictAddAuthFailed 21017
DistrictAddChildGT5 //DistrictAddChildGT5 21018
DistrictAddAuthGT10 //DistrictAddAuthGT10 21019
DistrictAddRoleGT20 //DistrictAddRoleGT20 21020
DistrictInviteLinkGT5 //DistrictInviteLinkGT5 21021
DiscHasExists //DiscHasExists 21022
DiscNoExists //DiscNoExists 21023
DiscUserUnitError //DiscUserUnitError 21024
DistrictLock //DistrictLock 21025
DiscDisTrans //DiscDisTrans 21026
DiscParentInvalid //DiscParentInvalid 21027
DistrictInviteLinkGT50 //DistrictInviteLinkGT5 21028
DiscIsUsed //DiscIsUsed 21029
DiscAndSeqeNoExists //DiscAndSeqeNoExists 21030
DiscAuthNoExists //DiscAuthNoExists 21031
PrizeRecordNoExists //PrizeRecordNoExists 21032
OrderDoesNotExist Code = iota + 21001 + 500 //OrderDoesNotExist 21501
OrderHasReceipted //OrderHasReceipted 21502
)
const (
_ = (iota * 100) + 9000
AdminIsExisted // AdminIsExisted 管理员存在 9100
AuthInUsing // 权限正在使用 9200
AuthIsNotExist // 权限不存在 9300
LoginMobileNotBind // 渠道后台账号没有绑定电话号码 9400
LoginMobileBindErr // 渠道后台账号绑定电话号码失败 9500
AiUnDressStatusIsErr // AI脱衣订单状态异常
AiChangeFaceImgStatusIsErr // AI图片换脸订单状态异常
AiMateIsNotExists // AI伴侣用户未开通
)
const (
LikeHasAlreadyThumbs Code = iota + 10000 //10000
LikeHasNotThumbs //LikeHasNotThumbs 10001
LikeErrGetDataFailed //LikeErrGetDataFailed 10002
LikeErrThumbsFailed //LikeErrThumbsFailed 10003
LikeErrCancelFailed //LikeErrCancelFailed 10004
LikeErrIncCountFailed //LikeErrIncCountFailed 10005
LikeErrDecCountFailed //LikeErrDecCountFailed 10006
LikeErrVideoIsInvalid //LikeErrVideoIsInvalid 10007
)
const (
CollectHasCollected Code = iota + 12000 //12000
CollectHasNotCollected //12001
CollectErrGetDataFailed //12002
CollectErrCollectFailed //12003
CollectErrCancelFailed //12004
)
const (
ErrGetTagDataFailed Code = (iota * 1000) + 13000
GoogleAuthFail // GoogleAuthFail 14000
Timeout // Timeout 超时时间 15000
)
const (
TagAddTagNameInvalidErr Code = iota + 16000 //TagAddTagNameInvalidErr tag名称无效 16000
TagAddTagNameEmptyErr //TagAddTagNameEmptyErr tag名称不能为空 16001
TagAddTagNameExistedErr //TagAddTagNameExistedErr tag名称已存在 16002
TagAddTagDescInvalidErr //TagAddTagDescInvalidErr tag描述无效 16003
)
const (
//proxy
SelfPromotionCode Code = iota + 17000 //SelfPromotionCode 17000
InvalidPromotionCode //17001
PromoteLoop //17002
NotInvitedUsers //17003
PromoteHasBind //17004 PromoteHasBind
)
const (
//daichong error
ErrTakeChatCode Code = iota + 18000 //发起代充聊天失败 18000
ErrGetOrderInfoCode //获取代理充值订单信息失败 18001
ErrAppIDNotExist //代充AppID 不存在 18002
ErrMerchantIsNotExist //此商人不存在 18003
ErrMerchantBalanceIsNotEnough //商人余额不足 18004
ErrMerchantBalanceHasLock //商人被禁止登陆 18005
ErrMerchantSeekScoreFail //商人追分失败 18006
ErrMerchantSeekScoreFailDueNotEnoughAmount //商人追分失败 18007
)
// 接口性能
const (
// Visit limit
VisitLimit Code = 19000 // 访问被限制
)
const (
ActClose Code = iota + 20000 //活动关闭 20000
ActUserDataTypeError //活动的用户数据类型错误 20001
ActInvitReceiveCoinsLessThan10 //推广活动领取的金币小于10 20002
ActLotteryNoTimes //轮盘活动次数不够了
)
// 后台渠道
const ChannelAgentExisted Code = iota + 21000 //渠道账号已经存在 20000
const (
ExchangeCodeProduceCodeFailed Code = iota + 22000 // 22000 兑换码生成失败
ExchangeCodeExchangeFailed // 22001 兑换失败
ExchangeCodeInvalidCode // 22002 无效兑换码
ExchangeCodeIsNotEffective // 22003 未到兑换时间
ExchangeCodeIsExpired // 22004 已过期
ExchangeCodeIsUsed // 22005 兑换码已经使用
ExchangeCodeInvalidApp // 22006 无效的app类型
ExchangeCodeInvalidAuthority // 22007 无效的权限类型
ExchangeCodeNullChannelForbidden // 22008 渠道不能为空
ExchangeCodeOperateDenied // 22009 权限不够,操作被拒绝
ExchangeCodeInvalidBatchNumber // 22010 无效的批次号
ExchangeCodeForbidUpdate // 22011 该兑换码已使用或者已过期,不能修改
ExchangeCodeRepeatExchange // 22012 一兑换过该批次的兑换码
ExchangeCodeInvalid // 22006 无效的兑换类型
)
// 机器人配置与内容
const (
RobotTypeInvalid Code = iota + 23000 // 23000 无效的机器人类型
RobotTypeExisted // 23001 该类机器人已经存在
RobotContentDelParamIsNull // 23002 删除机器人聊天内容的参数不能为空
RobotContentIsNull // 23003 增加的内容不能为空
RobotContentDelFailed // 23004 删除内容失败,没有改内容
RobotInvalidConf // 23005 机器人配置的最大值无效
)
// 机器人配置与内容
const (
NotSystemAds Code = iota + 25000 // 25000 不是系统广告
ADSNotExist // 25001 广告不存在
ADReviewNotExist // 25002 广告审核不存在
URLInvalid // 25003 URL非法
HostNameInvalid // 25004 域名非法
ErrADScant // 25005 广告大小或尺寸错误
)
const (
RecmdTagIsExisted Code = iota + 26000 //26000 推荐标签已存在
TagNotExist //26001 标签不存在
)
// 新版增加错误码
const (
NoWatchingCoupon Code = iota + 27000 //27000 没有观影券
PiggyBankNotEnough //27001 存钱罐余额不够
NoVipPrivilege //27002 没有vip权限
PayCoinsLimit200 //27003 观影券免费观看需200金币以下
NoVipNoUpload //27004 非vip限制3次上传
ExpiredVip //27005 vip已经过期
AiGenningDelForbidden //27006 ai订单不允许删除生成中的订单
ChangeFaceSuccessWithoutUrl //27007 ai订单通过时没有视频url
ChangeFaceNoModule //27008 ai换脸模版不存在
)
// 楼凤错误码
const (
RepeatUpload Code = iota + 28000 //未审核,重复提交验证报告
GetLockTimeout
OverTargetCoin
RepeatFeedback
LouFengNotExists //楼凤不存在
)
// 签到错误码
const (
PrizeIsExistError Code = iota + 29000
SignConfigIsExistError
ActivityDateError // 活动开始时间或者结束时间配置不正确
PhoneNotBoundOrNotRecharge //绑定手机号或充值才可签到
HasSigned // 已签到
ExceededTimes // 超出次数
)
const (
NudeChatRepeatFeedbackErr Code = iota + 30000 // 裸聊信息重复举报
NotBuyBanFeedbackErr // 未购买禁止举报
)
const (
AddTaskRepeatedError = 499
)
const (
VidNotExists Code = iota + 50000 // 视频不存在
OnlyOfficialVideo // 只能操作官方上传的视频
VideoTypeDissatisfy // 帖子类型不符合
VideoTagNoExists // 帖子标签未配置
VideoNotPass // 帖子未审核
VideoRepeatPop // 帖子重复推广
VideoNotPop // 帖子未推广
VideoInDiscountArea
NotAVideo
ContentSensitiveHit // 内容敏感词命中,不予上架
)
const (
InsufficientGold Code = iota + 40000 // 40000 金币不足
InsufficientPoint // 40001 积分不足
InsufficientLotteryFreeTimes // 40002 免费次数不足
)
const (
OfficialWebsiteBasicDataNotExist Code = iota + 60000 // 60000 官方站基础数据不存在
OfficialWebsiteBasicDataExist // 60001 官方站基础数据存在
OfficialWebsiteHeroExist // 60002 官方站创作者存在
OfficialWebsiteHeroNotExist // 60003 官方站创作者不存在
OfficialWebsiteAlbumExist // 60004 官方站专辑存在
OfficialWebsiteAlbumNotExist // 60005 官方站专辑不存在
OfficialWebsiteNewsExist // 60006 官方站新闻存在
OfficialWebsiteNewsNotExist // 60007 官方站新闻不存在
OfficialWebsitePartnerExist // 60008 官方站合作伙伴存在
OfficialWebsitePartnerNotExist // 60009 官方站合作伙伴不存在
OfficialWebsiteJobListExist // 60010 官方站职位列表存在
OfficialWebsiteJobListNotExist // 60011 官方站职位列表不存在
OfficialWebsiteVideoExist
OfficialWebsiteVideoNotExist
OfficialWebsiteImportVideoFailed
)
+31
View File
@@ -0,0 +1,31 @@
package stderr
import "fmt"
// CustomErr 代替/common/error中的定义,逐渐在代码中弃掉(common/error模块)
type CustomErr struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Tips string `json:"tips"`
}
// NewCustomErr an error
func NewCustomErr(code Code, Msg string, tips ...string) *CustomErr {
res := &CustomErr{
Code: code,
Msg: Msg,
Tips: Msg,
}
if len(tips) > 0 {
res.Tips = tips[0]
}
return res
}
// Error 返回字符串
func (s *CustomErr) Error() string {
if s == nil {
return ""
}
return fmt.Sprintf("code = %d, msg = %s ,tips = %v", s.Code, s.Msg, s.Tips)
}
+32
View File
@@ -0,0 +1,32 @@
package stderr
import (
"errors"
"strings"
)
var (
InsertExistError = errors.New("E11000 duplicate key error")
WriteBrokenError = errors.New("broken pipe")
)
func IsEqual(err error, target error) bool {
if err != nil && target != nil {
return err.Error() == target.Error()
}
return false
}
func IsContain(err interface{}, target error) bool {
if err != nil && target != nil {
var origin string
switch err := err.(type) {
case string:
origin = err
case error:
origin = err.Error()
}
return strings.Contains(origin, target.Error())
}
return false
}
+209
View File
@@ -0,0 +1,209 @@
package stderr
const AiGenningDelForbiddenMessage = "不可删除未完成的ai订单"
var codeAndMsg = map[Code]string{
Success: "success",
Failure: "Failed",
FunctionNotEnabled: "功能未开启,敬请期待!",
FunctionUpgrade: "功能维护升级中,敬请期待最新版本!",
ErrUnrecognized: "unknown error",
UserIsNotExists: "user is not exist",
UserIsException: "user is exception",
SignFailedToVerify: "sign verify failed",
ErrDownloadError: "file download fail",
ErrUploadError: "file upload fail",
UpLoadingFile: "uploading file",
ErrFsBucketNotExist: "fs bucket not exist",
ErrFsOptionWrong: "fs option wrong",
UpLoadFileComplete: "upload file complete",
ErrExportFileFail: "export file fail",
FileMerging: "file is merging",
FileConverting: "file is converting",
UploadLoadingToFs: "file is uploading fs",
ErrConnectToFs: "connect to fs server is fail",
ErrFsServerFile: "fs server error",
ErrMergeFile: "file merge error",
ErrConvertFile: "file convert error",
ErrPlayTimeTooShort: "video play time is too short",
ErrUploadExistVideo: "upload exist video",
CodeEmptyData: "empty data",
ErrMimeType: "mime type error",
ErrAccessForbid: "no access",
ErrNamePwdIncorrect: "userName or password error",
ErrUserNameTooLong: "user name too long, length must be less than or equal to 12 characters length",
ErrAuthExpired: "certificate expired",
ErrAuthInvalid: "invalid signature",
ErrLoginExpired: "login expired",
ErrUserBeBanned: "User has been banned",
ErrVersionUpdate: "new app version need update",
ErrVersionRange: "set version update range error",
ErrVersionTooLow: "specify upgrade version is too low",
ErrParamError: "parameters error",
ErrReqForbidden: "request rejected",
ErrPathNotFount: "request path does not exist",
ErrMethodIncorrect: "request method error",
ErrTimeout: "service timeout",
ErrLoginTooFrequently: "login too frequently",
ErrSmsSendFail: "send sms code fail",
ErrNetWorkBusy: "network bad",
ErrInvalidRequest: "invalid request",
ErrServerUnavailable: "service is not available",
ErrDbQueryError: "database query error",
ErrDbInsertError: "database insert error",
ErrDbUpdateError: "database update error",
ErrDbDeleteError: "database delete error",
ErrDbInputExist: "current input has already exists",
ErrDeviceIdAndMobileNil: "devId and mobile nil",
ErrNoToken: "no token",
InvalidToken: "invalid token",
ErrCaptcha: "captcha err",
ErrCaptchaInvalid: "invalid",
ErrWithDrawAccountHasBind: "current withDraw account has bind",
PayBusy: "business too busy now,please try again later",
ErrCaptchaExists: "captcha code exist",
InsufficientBalance: "Insufficient balance",
RechargeFaile: "Other toPay error",
InvalidBankCard: "Invalid BankCard",
ErrMobileHasBind: "you have already bind this phone number",
ErrMobileInvalid: "invalid phone number",
ErrTokenIsNotExist: "token is not exist",
UnkonwErr: "Unkonw Err 订单异常,请与第三方核对该订单信息",
RepeatSubmitOrder: "订单在处理中,请勿重复提交",
CanNotTransfer: "划转功能已关闭,请在游戏钱包充值",
DifferentBankActName: "The name of the new card must be the same as your previous cash card name (Zhang San). Please fill in the bank card with the same name before cashing out. If you need to change your name, please contact customer service.",
ErrLoginMobileNotExist: "current phone is not bind",
InvalidProduct: "invalid product",
RepeatPurchase: "repeat purchase",
AdminIsNotExist: "admin is not exist, the account or password is incorrect.",
ErrEmailHasBinded: "邮箱已被绑定,请直接登录",
ErrEmailBindedByOther: "该邮箱已被其他用户使用,请换一个",
ErrAccountHasBinded: "账号已被绑定,请直接登录",
ErrAccountBindedByOther: "改账号已被其他用户使用,请换一个",
ErrAccountHasIllegalContent: "您的账号有非法内容,请换一个",
ErrInvalidAccount: "系统不存在此账号,请确认输入的账号已经注册",
ErrInterServerError: "系统内部错误,请联系客服",
ErrInvalidEmail: "邮箱格式有误,请重试",
ErrDbTooMuchRecords: "查询数据量太大,请缩小查询范围",
AdvanceOrderStatusIsErr: "预售订单异常",
AdvanceOrderPayTimeIsErr: "预售订单支付时间异常",
BuyFailed: "but failed,please try again later",
AdminIsExisted: "the account is existed",
AuthInUsing: "auth in using",
AuthIsNotExist: "auth is not exist",
GoogleAuthFail: "google 2 factor faild",
CommentErrSendFail: "Comment publish failed",
CommentErrGetDataFail: "Get data failed",
CommentErrIncCountFailed: "Increase comment count failed",
CommentErrDecCountFailed: "Decrease comment count failed",
CommentErrVideoIsInvalid: "Video is not verified",
CommentUserHasBanned: "您已被禁言!",
CommentUserNotBind: "您暂未绑定手机,无法发表评论",
ErrMobileHasBindByOther: "current phone has already bind by other",
CommentPublishTooFrequent: "Comment Publish Too Frequently",
CommentUserInfoErr: "User information is error",
CommentVideoInfoErr: "Video information is error",
CommentNotVip: "User is not vip",
CommentCountOverLimit: "非vip用户每24小时只能发送限量评论",
LikeHasAlreadyThumbs: "Has already liked, can't like it again",
LikeHasNotThumbs: "Has not liked, can't cancel",
LikeErrGetDataFailed: "Get like data error",
LikeErrThumbsFailed: "Like it failed",
LikeErrCancelFailed: "Cancel like failed",
LikeErrIncCountFailed: "Increase like count failed",
LikeErrDecCountFailed: "Decrease like count failed",
LikeErrVideoIsInvalid: "Video is not verified",
CollectHasCollected: "Has already collected, can't collect it again",
CollectHasNotCollected: "Has not collected, can't cancel",
CollectErrGetDataFailed: "Get collect data failed",
CollectErrCollectFailed: "Do collect failed",
CollectErrCancelFailed: "Cancel collect failed",
ErrGetTagDataFailed: "Get tag data failed",
Timeout: "timeout",
SelfPromotionCode: "The inviter cannot be himself",
InvalidPromotionCode: "invalid promotion code",
PromoteLoop: "Already a subordinate agent, not a superior agent",
NotInvitedUsers: "Not Invited Users",
PromoteHasBind: "current promote has bind",
TagAddTagNameInvalidErr: "Tag name is invalid",
TagAddTagNameEmptyErr: "Tag name is empty",
TagAddTagNameExistedErr: "Current Tag name is existed",
//daichong
ErrTakeChatCode: "take daichong chat failed",
ErrGetOrderInfoCode: "get daichong order info failed",
ErrAppIDNotExist: "daichong appid is not exist",
ErrMerchantIsNotExist: "current merchant not exist",
ErrMerchantBalanceIsNotEnough: "商人余额不足",
ErrMerchantBalanceHasLock: "商人被禁止登陆",
VisitLimit: "操作太频繁,请稍后再试!",
ActClose: "activity has closed",
ActUserDataTypeError: "act userData type error",
ChannelAgentExisted: "该账号已经存在",
// 兑换码
ExchangeCodeProduceCodeFailed: "Produce code failed",
ExchangeCodeExchangeFailed: "Exchange failed",
ExchangeCodeInvalidCode: "Invalid code",
ExchangeCodeIsNotEffective: "Code is inactive",
ExchangeCodeIsExpired: "Code is expired",
ExchangeCodeIsUsed: "Code has used",
ExchangeCodeInvalidApp: "Invalid app type",
ExchangeCodeInvalidAuthority: "Invalid authority type",
ExchangeCodeNullChannelForbidden: "Null channel is forbidden",
ExchangeCodeOperateDenied: "Operate denied",
ExchangeCodeInvalidBatchNumber: "Batch number invalid",
ExchangeCodeForbidUpdate: "The code is expired or used, can't update",
ExchangeCodeRepeatExchange: "Has exchanged",
RobotTypeInvalid: "Invalid robot type",
RobotTypeExisted: "Existed robot type",
RobotContentDelParamIsNull: "Param delete content is null",
RobotContentIsNull: "Content is null",
RobotContentDelFailed: "Content is empty",
DistrictActErr: "错误的商区账号",
RepeatUpload: "Repeat Upload",
GetLockTimeout: "获取抽奖状态锁超时",
OverTargetCoin: "活动当前金额已经达目标金额,无法再投注",
RepeatFeedback: "Repeat Feedback",
LouFengNotExists: "invalid loufeng",
AdminIsHasLockedErr: "管理员被封禁",
LiaoBaTopOverLimit: "撩吧置顶超出10条,请先删除多余置顶帖子",
ExchangeCodeInvalid: "PayType Error",
PrizeIsExistError: "奖品名称重复",
SignConfigIsExistError: "同类型配置;达成条件已存在",
ActivityDateError: "活动开始时间或者结束时间配置不正确",
PhoneNotBoundOrNotRecharge: "绑定手机号或充值才可签到",
UserIsNotMerchant: "用户不是商家",
UserActiveNotEnough: "活跃度不足",
NudeChatRepeatFeedbackErr: "本条信息已举报,请耐心等待平台处理!",
NotBuyBanFeedbackErr: "未购买不能举报!",
ResolutionNotEnough: "分辨率不足",
WithdrawBusy: "提现操作过于频繁,请稍后再试",
WithDrawIllegalAmount: "提现金额不满足要求,请阅读提现说明",
ModuleConfLimitExceed: "模块下专题数量超过限制",
GetLikesBusy: "操作太过频繁,请稍后再试",
GetBuyVidBusy: "操作太过频繁,请稍后再试",
CommentNotRchg: "非充值用户不可评论",
CommentOnlyMerchant: "该商家已开启禁止评论权限",
AddTaskRepeatedError: "已有相同类型任务. 请在该任务上编辑即可, 不需要新增",
UserHasDoTask: "用户重复领取任务",
UserHasReceivedIntegral: "用户重复领取积分",
InsufficientIntegral: "用户积分不足",
CommentOneMinuteOverLimit: "非VIP一分钟只能评论一次,升级会员,可无限评论",
DownloadCountIsNotEnough: "下载次数不足,请您充值VIP获取次数",
AiGenningDelForbidden: AiGenningDelForbiddenMessage,
ChangeFaceSuccessWithoutUrl: "通过ai换脸订单时生成的视频链接不可为空",
ChangeFaceNoModule: "ai换脸模版不存在,请检查模版",
NoSelfAddMsg: "不能给自己发消息",
AiUnDressStatusIsErr: "AI脱衣订单状态异常",
AiChangeFaceImgStatusIsErr: "AI图片换脸订单状态异常",
PrizeRecordNoExists: "抽奖信息不存在",
VideoInDiscountArea: "视频已经在其他折扣区",
NotAVideo: "不是视频",
ContentSensitiveHit: "内容敏感词命中,不予上架",
ErrDataInvalid: "数据不合法",
AiMateIsNotExists: "AI伴侣服务用户未开通!",
FunctionUpgradeToLatest: "功能已升级,请重新下载最新版本安装使用",
VideoTypeDissatisfy: "帖子类型不符合",
InsufficientGold: "金币不足",
InsufficientPoint: "积分不足",
InsufficientLotteryFreeTimes: "免费次数不足",
}
+47
View File
@@ -0,0 +1,47 @@
package stderr
import "fmt"
type Code int
type CodeMsg struct {
Code int `json:"code"`
Msg string `json:"msg"`
Tip string `json:"tip,omitempty"`
}
func (c Code) Msg() string {
msg, ok := codeAndMsg[c]
if ok {
return msg
}
return ""
}
func (c Code) Tip() string {
tip, ok := codeAndTip[c]
if ok {
return tip
}
return ""
}
func (c Code) Error() string {
return fmt.Sprintf("code=%d,msg=%v,tip=%v", c, c.Msg(), c.Tip())
}
func (c Code) Struct() CodeMsg {
return CodeMsg{Code: int(c), Msg: c.Msg(), Tip: c.Tip()}
}
func New(code int, msg string) error {
return fmt.Errorf("code:%d,msg:%s", code, msg)
}
func (c Code) SetMsg(msg string) CodeMsg {
return CodeMsg{Code: int(c), Msg: msg, Tip: c.Tip()}
}
func (c Code) SetTip(tip string) CodeMsg {
return CodeMsg{Code: int(c), Msg: c.Msg(), Tip: tip}
}
+192
View File
@@ -0,0 +1,192 @@
package stderr
var codeAndTip = map[Code]string{
FunctionNotEnabled: "功能未开启,敬请期待!",
FunctionUpgrade: "功能维护升级中,敬请期待最新版本!",
UserActiveNotEnough: "活跃度不足",
BadUA: "请至官网下载最新版本",
ErrParamError: "参数错误",
InvalidToken: "用户信息已经过期,请重新登陆",
UserIsNotExists: "用户不存在",
UserIsException: "异常用户",
ErrUserBeBanned: "用户已被禁言",
ErrAccessForbid: "没有访问权限",
ErrNamePwdIncorrect: "用户名或密码错误",
InsufficientBalance: "余额不足",
RechargeFaile: "支付失败,稍后再试",
UnkonwErr: "订单异常,请与第三方核对",
RepeatPurchase: "已经购买过了",
GoldVideoCoupleNotExist: "金币视频抵用券不存在",
GoldVideoCoupleAmountErr: "金币视频抵用券面值必须大于视频金额",
BuyFailed: "购买失败,请稍后尝试",
PayBusy: "支付繁忙,请稍后再试!",
ErrNetWorkBusy: "网络异常,请稍后尝试",
CanNotTransfer: "划转功能已关闭,请在游戏钱包充值",
DifferentBankActName: "新卡姓名必须与您以前的提现卡姓名(张三)一致,请填写同名银行卡后再提现。如需更改姓名请联系客服。",
WithdrawBusy: "提现操作过于频繁,请稍后再试",
WithDrawIllegalAmount: "提现金额不满足要求,请阅读提现说明",
GetLikesBusy: "操作太过频繁,请稍后再试",
GetBuyVidBusy: "操作太过频繁,请稍后再试",
CommentNotRchg: "非充值用户不可评论",
CommentOnlyMerchant: "该商家已开启禁止评论权限",
InvalidPromotionCode: "无效的推广码",
PromoteLoop: "您已绑定下级,无法绑定上级",
PromoteHasBind: "您已经绑定了该推广码",
ErrWithDrawAccountHasBind: "当前提现账号已经被绑定,请添加新账号",
ErrQrInvalid: "二维码失效",
ErrCustomerBanned: "客服已经休息啦,请稍后再联系",
SelfPromotionCode: "不能填写自己的邀请码",
ErrCaptchaExists: "短信验证码已经发出,请不要重复发送",
ErrVersionUpdate: "请更新最新版本",
ErrVersionRange: "设置版本更新范围错误,上限版本不能小于下限版本",
CollectHasCollected: "您已经收藏过了",
CollectHasNotCollected: "您还没有收藏它",
LikeHasAlreadyThumbs: "您已经点过赞了",
LikeHasNotThumbs: "您还没有对它点赞",
CommentUserNotBind: "您暂未绑定手机,无法发表评论",
VisitLimit: "操作太频繁,请稍后再试!",
NotInvitedUsers: "您不是推广用户",
CommentPublishTooFrequent: "您发言太频繁了,请稍后再试~",
CommentErrSendFail: "评论发送失败",
ActClose: "活动已关闭!",
ActInvitReceiveCoinsLessThan10: "推广活动,至少领取10金币",
ErrReqForbidden: "该请求被拒绝",
ErrInvalidRequest: "非法请求",
ErrLoginMobileNotExist: "该手机号未绑定",
AdvanceOrderStatusIsErr: "预售订单异常",
AdvanceOrderPayTimeIsErr: "预售订单支付时间异常",
ErrMobileInvalid: "手机号不合法",
ErrUserNameTooLong: "用户名过长,请限制在20个字符",
CommentNotVip: "对不起!您为非vip用户,不能发表评论!",
ErrMobileHasBind: "您已经绑定了此号码",
ErrMobileHasBindByOther: "当前手机号码,已被使用,请输入新号码",
ErrCaptcha: "验证码已过期,请重新获取",
ErrSmsSendFail: "验证码发送失败",
ErrCaptchaInvalid: "验证码不正确,请重新发送",
ErrFsServerFile: "文件服务繁忙,请稍后再试",
ErrPlayTimeTooShort: "上传视频应大于10秒",
ErrUploadExistVideo: "请勿重复上传视频",
ForbidUploadVideo: "您因违反规定,上传违规内容视频,已经被禁止上传,请联系客服解封!",
ErrConnectToFs: "网络繁忙,请稍后再试",
AgentNotInvitedUID: "代理没有邀请该用户",
DistrictActIsNotExist: "账户不存在",
DistrictInsufficientBalance: "余额不足",
DistrictWithdrawAmountTooLittleError: "提现金额太少, 单次不能少于100元",
DistrictWithdrawAmountTooMuchError: "提现金额太多, 单次不能超过10000元",
DistrictWithdrawMethodInvalidError: "提现方法失效",
DistrictWithdrawFailed: "提现失败",
DistrictWithdrawTooFast: "提现太快",
DistrictPasswordError: "密码错误",
DistrictMobileHasBinded: "手机号已被绑定",
DistrictNotHaveMobile: "用户没有绑定手机",
DistrictTimeOutOfRange7: "时间超过7天",
DistrictLessThanDividendRatio: "优化分红比例不能小于实际分红比例",
DistrictTypeIsNotExist: "不存在的商区类型",
DistrictDedTypeIsNotExist: "不存在的扣量类型",
DistrictConDedSetIsNotComplete: "用户消费扣量设置不完整",
DistrictNUDedSetIsNotComplete: "用户新增扣量设置不完整",
DistrictCodeTooLong: "商区码不能超过8个字符",
UserNotDistrictAgent: "该用户不是代理用户",
DistrictAgentNotBind: "该手机号码未绑定用户",
DiscNameExists: "账号已存在",
DiscCodeExists: "商区码已存在",
DiscOptDividendRatioIsNotExist: "优化分红比例不存在",
DiscDividendRatioIsNotExist: "分红比例不存在",
DiscAuthInUsing: "权限被占用",
DiscAuthIsNotExist: "权限不存在",
DistrictDividendBreakdown: "分红比例击穿",
DistrictRoleIsNotExist: "角色不存在",
DistrictCPACantAddCPS: "CPA商区不能添加CPS商区",
DistrictAddAuthFailed: "添加权限失败",
DistrictAddChildGT5: "最多添加5个子商区",
DistrictAddAuthGT10: "最多添加10个权限",
DistrictAddRoleGT20: "最多添加20个角色",
DistrictInviteLinkGT5: "最多添加5个推广链接",
DiscHasExists: "商区已经存在",
DiscNoExists: "商区不存在",
DiscUserUnitError: "用户单价错误",
DistrictLock: "系统升级中,无法登陆",
DiscDisTrans: "暂时无法提现",
DiscParentInvalid: "父商区无效",
DistrictInviteLinkGT50: "最多添加50个子商区",
DiscIsUsed: "商区被使用",
DiscAndSeqeNoExists: "商区码或序号不存在",
DiscAuthNoExists: "帐号没有配置权限, 请联系客服获取权限",
ErrEmailHasBinded: "邮箱已被绑定,请直接登录",
ErrEmailBindedByOther: "该邮箱已被其他用户使用,请换一个",
ErrAccountHasBinded: "账号已被绑定,请直接登录",
ErrAccountBindedByOther: "改账号已被其他用户使用,请换一个",
ErrAccountHasIllegalContent: "您的账号有非法内容,请换一个",
ErrInvalidAccount: "系统不存在此账号,请确认输入的账号已经注册",
ErrInterServerError: "系统内部错误,请联系客服",
ErrInvalidEmail: "邮箱格式有误,请重试",
ErrDbTooMuchRecords: "查询数据量太大,请缩小查询范围",
OrderDoesNotExist: "订单不存在",
OrderHasReceipted: "订单已回执",
ErrVersionTooLow: "指定的升级版本太低",
ExchangeCodeProduceCodeFailed: "兑换码生成失败",
ExchangeCodeExchangeFailed: "兑换失败,请重试",
ExchangeCodeInvalidCode: "无效兑换码",
ExchangeCodeIsNotEffective: "该兑换码未到兑换时间",
ExchangeCodeIsExpired: "该兑换码已经过期",
ExchangeCodeIsUsed: "兑换码已经使用",
ExchangeCodeInvalidApp: "无效的app类型",
ExchangeCodeInvalidAuthority: "无效的权限类型",
ExchangeCodeNullChannelForbidden: "渠道不能为空",
ExchangeCodeOperateDenied: "权限不够,操作被拒绝",
ExchangeCodeInvalidBatchNumber: "无效的批次号",
ExchangeCodeForbidUpdate: "该兑换码已使用或者已过期,不能修改",
ExchangeCodeRepeatExchange: "您已兑换过",
ErrLoginTooFrequently: "官人,您进进出出太快了,小娘子受不了了,一会儿再来哦",
RobotTypeInvalid: "无效的机器人类型",
RobotTypeExisted: "机器人类型已经存在",
RobotContentDelParamIsNull: "删除机器人聊天内容的参数不能为空",
RobotContentIsNull: "增加的内容不能为空",
RobotContentDelFailed: "删除内容失败,没有改内容",
TagAddTagNameEmptyErr: "标签名称不能为空",
TagAddTagDescInvalidErr: "标签描述无效",
TagAddTagNameInvalidErr: "输入的标签名称存在违规词汇,请重新输入新名称",
TagAddTagNameExistedErr: "当前标签已经存在,请输入新标签",
NotSystemAds: "不是系统广告",
ADSNotExist: "广告不存在",
ADReviewNotExist: "广告审核不存在",
URLInvalid: "URL非法",
HostNameInvalid: "域名错误",
ErrADScant: "尺寸错误",
NoVipNoUpload: "非vip限制3次上传",
ExpiredVip: "金币月卡时间已经过期",
AiGenningDelForbidden: "不可删除未完成的ai订单",
ChangeFaceSuccessWithoutUrl: "通过ai换脸订单时生成的视频链接不可为空",
ChangeFaceNoModule: "ai换脸模版不存在,请检查模版",
RecmdTagIsExisted: "推荐标签已存在",
TagNotExist: "标签不存在",
NoVipPrivilege: "非充值用户不能进行操作",
RepeatUpload: "Repeat Upload",
GetLockTimeout: "获取抽奖状态锁超时",
OverTargetCoin: "活动当前金额已经达目标金额,无法再投注",
RepeatFeedback: "不可重复提交楼凤举报",
LouFengNotExists: "该楼凤数据异常,暂时无法举报",
ExchangeCodeInvalid: "PayType Error",
ModuleConfLimitExceed: "模块下专题数量超过限制",
ResolutionNotEnough: "分辨率不足",
CommentUserHasBanned: "您已被禁言,请联系客服!",
PhoneNotBoundOrNotRecharge: "绑定手机或充值才可签到",
UserHasDoTask: "用户重复领取任务",
UserHasReceivedIntegral: "用户重复领取积分",
InsufficientIntegral: "用户积分不足",
CommentOneMinuteOverLimit: "非VIP一分钟只能评论一次,升级会员,可无限评论",
DownloadCountIsNotEnough: "下载次数不足,请您充值VIP获取次数",
NoSelfAddMsg: "不能给自己发消息",
AiUnDressStatusIsErr: "AI脱衣订单状态异常",
AiChangeFaceImgStatusIsErr: "AI图片换脸订单状态异常",
PrizeRecordNoExists: "抽奖信息不存在",
ErrTimeIsEmpty: "时间范围不能为空",
ErrTimeWithinWeek: "时间跨度不能超过一周",
OrganizeInsufficientIntegral: "组织积分不足",
ErrDataInvalid: "数据不合法",
AiMateIsNotExists: "AI伴侣服务用户未开通!",
FunctionUpgradeToLatest: "功能已升级,请重新下载最新版本安装使用",
InsufficientGold: "金币不足",
InsufficientPoint: "积分不足",
InsufficientLotteryFreeTimes: "免费次数不足",
}