初始化项目
This commit is contained in:
93
consts/consts.go
Normal file
93
consts/consts.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package consts
|
||||
|
||||
// Redis键前缀
|
||||
const (
|
||||
AdRequestLimitKeyPrefix = "ad_request_limit:" // 广告请求限流键前缀
|
||||
RateLimitKeyPrefix = "rate_limit:" // 通用限流键前缀
|
||||
SessionCacheKeyPrefix = "session_cache:" // 会话缓存键前缀
|
||||
)
|
||||
|
||||
// 广告源状态
|
||||
const (
|
||||
AdSourceStatusActive = "active" // 活跃
|
||||
AdSourceStatusInactive = "inactive" // 非活跃
|
||||
AdSourceStatusMaintenance = "maintenance" // 维护中
|
||||
)
|
||||
|
||||
// 广告源健康状态
|
||||
const (
|
||||
AdSourceHealthHealthy = "healthy" // 健康
|
||||
AdSourceHealthDegraded = "degraded" // 降级
|
||||
AdSourceHealthUnhealthy = "unhealthy" // 不健康
|
||||
)
|
||||
|
||||
// 广告源类型
|
||||
const (
|
||||
AdSourceTypeSelf = "self" // 自营
|
||||
AdSourceTypeThirdParty = "third_party" // 第三方
|
||||
AdSourceTypeExchange = "exchange" // 广告交易平台
|
||||
)
|
||||
|
||||
// 广告源提供商
|
||||
const (
|
||||
AdSourceProviderGoogle = "google" // Google
|
||||
AdSourceProviderBaidu = "baidu" // 百度
|
||||
AdSourceProviderTencent = "tencent" // 腾讯
|
||||
AdSourceProviderSelf = "self" // 自营
|
||||
)
|
||||
|
||||
// 认证类型
|
||||
const (
|
||||
AuthTypeAPIKey = "api_key" // API密钥
|
||||
AuthTypeOAuth = "oauth" // OAuth
|
||||
AuthTypeBasic = "basic" // Basic认证
|
||||
)
|
||||
|
||||
// 竞价类型
|
||||
const (
|
||||
BiddingTypeCPM = "cpm" // 千次展示成本
|
||||
BiddingTypeCPC = "cpc" // 每次点击成本
|
||||
BiddingTypeCPA = "cpa" // 每次行动成本
|
||||
BiddingTypeRTB = "rtb" // 实时竞价
|
||||
)
|
||||
|
||||
// 广告格式类型
|
||||
const (
|
||||
AdFormatTypeBanner = "banner" // 横幅广告
|
||||
AdFormatTypeVideo = "video" // 视频广告
|
||||
AdFormatTypeNative = "native" // 原生广告
|
||||
AdFormatTypeInterstitial = "interstitial" // 插屏广告
|
||||
)
|
||||
|
||||
// 计费模式
|
||||
const (
|
||||
BillingModelCPM = "cpm" // 千次展示成本
|
||||
BillingModelCPC = "cpc" // 每次点击成本
|
||||
BillingModelCPA = "cpa" // 每次行动成本
|
||||
BillingModelRevShare = "rev_share" // 收入分成
|
||||
)
|
||||
|
||||
// 支付条款
|
||||
const (
|
||||
PaymentTermsNet30 = "net_30" // 30天
|
||||
PaymentTermsNet60 = "net_60" // 60天
|
||||
PaymentTermsNet90 = "net_90" // 90天
|
||||
)
|
||||
|
||||
// 默认配置值
|
||||
const (
|
||||
DefaultTimeout = 5000 // 默认超时时间(毫秒)
|
||||
DefaultRetryCount = 3 // 默认重试次数
|
||||
DefaultPriority = 1 // 默认优先级
|
||||
)
|
||||
|
||||
// 错误消息
|
||||
const (
|
||||
ErrAdSourceNotFound = "广告源不存在"
|
||||
ErrAdSourceNameExists = "广告源名称已存在"
|
||||
ErrAdSourceCodeExists = "广告源编码已存在"
|
||||
ErrAdSourceInactive = "广告源非活跃状态"
|
||||
ErrAdSourceUnhealthy = "广告源健康状态异常"
|
||||
ErrRateLimitExceeded = "请求频率超限"
|
||||
ErrInvalidConfiguration = "配置参数无效"
|
||||
)
|
||||
@@ -31,7 +31,6 @@ const (
|
||||
|
||||
// 限流键
|
||||
const (
|
||||
AdRequestLimitKeyPrefix = "cid:limit:req:" // 广告请求限流键前缀
|
||||
ApiRequestLimitKeyPrefix = "cid:limit:api:" // API请求限流键前缀
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user