Dockerfile

This commit is contained in:
2026-03-23 14:08:11 +08:00
parent c7a2f5bd0c
commit 827d55dbee
100 changed files with 3139 additions and 5992 deletions

View File

@@ -1,57 +0,0 @@
package consts
// AdFormatType 广告格式类型枚举
type AdFormatType string
const (
AdFormatTypeBanner AdFormatType = "banner" // 横幅广告
AdFormatTypeVideo AdFormatType = "video" // 视频广告
AdFormatTypeNative AdFormatType = "native" // 原生广告
AdFormatTypeInterstitial AdFormatType = "interstitial" // 插屏广告
)
// GetAllAdFormatTypes 获取所有广告格式类型
func GetAllAdFormatTypes() []AdFormatType {
return []AdFormatType{
AdFormatTypeBanner,
AdFormatTypeVideo,
AdFormatTypeNative,
AdFormatTypeInterstitial,
}
}
type AdFormatTypeKeyValue struct {
Key AdFormatType
Value string
}
var (
AdFormatTypeBannerKeyValue = AdFormatTypeKeyValue{Key: AdFormatTypeBanner, Value: "横幅广告"}
AdFormatTypeVideoKeyValue = AdFormatTypeKeyValue{Key: AdFormatTypeVideo, Value: "视频广告"}
AdFormatTypeNativeKeyValue = AdFormatTypeKeyValue{Key: AdFormatTypeNative, Value: "原生广告"}
AdFormatTypeInterstitialKeyValue = AdFormatTypeKeyValue{Key: AdFormatTypeInterstitial, Value: "插屏广告"}
)
func GetAllAdFormatTypeKeyValue() []AdFormatTypeKeyValue {
return []AdFormatTypeKeyValue{
AdFormatTypeBannerKeyValue,
AdFormatTypeVideoKeyValue,
AdFormatTypeNativeKeyValue,
AdFormatTypeInterstitialKeyValue,
}
}
var adFormatTypeValueMap = map[AdFormatType]string{
AdFormatTypeBanner: AdFormatTypeBannerKeyValue.Value,
AdFormatTypeVideo: AdFormatTypeVideoKeyValue.Value,
AdFormatTypeNative: AdFormatTypeNativeKeyValue.Value,
AdFormatTypeInterstitial: AdFormatTypeInterstitialKeyValue.Value,
}
func GetAdFormatTypeValueByKey(key AdFormatType) (value string) {
value, exists := adFormatTypeValueMap[key]
if !exists {
value = "未知广告格式"
}
return
}

View File

@@ -1,52 +0,0 @@
package consts
// AdSourceHealth 广告源健康状态枚举
type AdSourceHealth string
const (
AdSourceHealthHealthy AdSourceHealth = "healthy" // 健康
AdSourceHealthDegraded AdSourceHealth = "degraded" // 降级
AdSourceHealthUnhealthy AdSourceHealth = "unhealthy" // 不健康
)
// GetAllAdSourceHealths 获取所有广告源健康状态
func GetAllAdSourceHealths() []AdSourceHealth {
return []AdSourceHealth{
AdSourceHealthHealthy,
AdSourceHealthDegraded,
AdSourceHealthUnhealthy,
}
}
type AdSourceHealthKeyValue struct {
Key AdSourceHealth
Value string
}
var (
AdSourceHealthHealthyKeyValue = AdSourceHealthKeyValue{Key: AdSourceHealthHealthy, Value: "健康"}
AdSourceHealthDegradedKeyValue = AdSourceHealthKeyValue{Key: AdSourceHealthDegraded, Value: "降级"}
AdSourceHealthUnhealthyKeyValue = AdSourceHealthKeyValue{Key: AdSourceHealthUnhealthy, Value: "不健康"}
)
func GetAllAdSourceHealthKeyValue() []AdSourceHealthKeyValue {
return []AdSourceHealthKeyValue{
AdSourceHealthHealthyKeyValue,
AdSourceHealthDegradedKeyValue,
AdSourceHealthUnhealthyKeyValue,
}
}
var adSourceHealthValueMap = map[AdSourceHealth]string{
AdSourceHealthHealthy: AdSourceHealthHealthyKeyValue.Value,
AdSourceHealthDegraded: AdSourceHealthDegradedKeyValue.Value,
AdSourceHealthUnhealthy: AdSourceHealthUnhealthyKeyValue.Value,
}
func GetAdSourceHealthValueByKey(key AdSourceHealth) (value string) {
value, exists := adSourceHealthValueMap[key]
if !exists {
value = "未知健康状态"
}
return
}

View File

@@ -1,57 +0,0 @@
package consts
// AdSourceProvider 广告源提供商枚举
type AdSourceProvider string
const (
AdSourceProviderGoogle AdSourceProvider = "google" // Google
AdSourceProviderBaidu AdSourceProvider = "baidu" // 百度
AdSourceProviderTencent AdSourceProvider = "tencent" // 腾讯
AdSourceProviderSelf AdSourceProvider = "self" // 自营
)
// GetAllAdSourceProviders 获取所有广告源提供商
func GetAllAdSourceProviders() []AdSourceProvider {
return []AdSourceProvider{
AdSourceProviderGoogle,
AdSourceProviderBaidu,
AdSourceProviderTencent,
AdSourceProviderSelf,
}
}
type AdSourceProviderKeyValue struct {
Key AdSourceProvider
Value string
}
var (
AdSourceProviderGoogleKeyValue = AdSourceProviderKeyValue{Key: AdSourceProviderGoogle, Value: "Google"}
AdSourceProviderBaiduKeyValue = AdSourceProviderKeyValue{Key: AdSourceProviderBaidu, Value: "百度"}
AdSourceProviderTencentKeyValue = AdSourceProviderKeyValue{Key: AdSourceProviderTencent, Value: "腾讯"}
AdSourceProviderSelfKeyValue = AdSourceProviderKeyValue{Key: AdSourceProviderSelf, Value: "自营"}
)
func GetAllAdSourceProviderKeyValue() []AdSourceProviderKeyValue {
return []AdSourceProviderKeyValue{
AdSourceProviderGoogleKeyValue,
AdSourceProviderBaiduKeyValue,
AdSourceProviderTencentKeyValue,
AdSourceProviderSelfKeyValue,
}
}
var adSourceProviderValueMap = map[AdSourceProvider]string{
AdSourceProviderGoogle: AdSourceProviderGoogleKeyValue.Value,
AdSourceProviderBaidu: AdSourceProviderBaiduKeyValue.Value,
AdSourceProviderTencent: AdSourceProviderTencentKeyValue.Value,
AdSourceProviderSelf: AdSourceProviderSelfKeyValue.Value,
}
func GetAdSourceProviderValueByKey(key AdSourceProvider) (value string) {
value, exists := adSourceProviderValueMap[key]
if !exists {
value = "未知提供商"
}
return
}

View File

@@ -1,52 +0,0 @@
package consts
// AdSourceStatus 广告源状态枚举
type AdSourceStatus string
const (
AdSourceStatusActive AdSourceStatus = "active" // 活跃
AdSourceStatusInactive AdSourceStatus = "inactive" // 非活跃
AdSourceStatusMaintenance AdSourceStatus = "maintenance" // 维护中
)
// GetAllAdSourceStatuses 获取所有广告源状态
func GetAllAdSourceStatuses() []AdSourceStatus {
return []AdSourceStatus{
AdSourceStatusActive,
AdSourceStatusInactive,
AdSourceStatusMaintenance,
}
}
type AdSourceStatusKeyValue struct {
Key AdSourceStatus
Value string
}
var (
AdSourceStatusActiveKeyValue = AdSourceStatusKeyValue{Key: AdSourceStatusActive, Value: "活跃"}
AdSourceStatusInactiveKeyValue = AdSourceStatusKeyValue{Key: AdSourceStatusInactive, Value: "非活跃"}
AdSourceStatusMaintenanceKeyValue = AdSourceStatusKeyValue{Key: AdSourceStatusMaintenance, Value: "维护中"}
)
func GetAllAdSourceStatusKeyValue() []AdSourceStatusKeyValue {
return []AdSourceStatusKeyValue{
AdSourceStatusActiveKeyValue,
AdSourceStatusInactiveKeyValue,
AdSourceStatusMaintenanceKeyValue,
}
}
var adSourceStatusValueMap = map[AdSourceStatus]string{
AdSourceStatusActive: AdSourceStatusActiveKeyValue.Value,
AdSourceStatusInactive: AdSourceStatusInactiveKeyValue.Value,
AdSourceStatusMaintenance: AdSourceStatusMaintenanceKeyValue.Value,
}
func GetAdSourceStatusValueByKey(key AdSourceStatus) (value string) {
value, exists := adSourceStatusValueMap[key]
if !exists {
value = "未知状态"
}
return
}

View File

@@ -1,52 +0,0 @@
package consts
// AdSourceType 广告源类型枚举
type AdSourceType string
const (
AdSourceTypeSelf AdSourceType = "self" // 自营
AdSourceTypeThirdParty AdSourceType = "third_party" // 第三方
AdSourceTypeExchange AdSourceType = "exchange" // 广告交易平台
)
// GetAllAdSourceTypes 获取所有广告源类型
func GetAllAdSourceTypes() []AdSourceType {
return []AdSourceType{
AdSourceTypeSelf,
AdSourceTypeThirdParty,
AdSourceTypeExchange,
}
}
type AdSourceTypeKeyValue struct {
Key AdSourceType
Value string
}
var (
AdSourceTypeSelfKeyValue = AdSourceTypeKeyValue{Key: AdSourceTypeSelf, Value: "自营"}
AdSourceTypeThirdPartyKeyValue = AdSourceTypeKeyValue{Key: AdSourceTypeThirdParty, Value: "第三方"}
AdSourceTypeExchangeKeyValue = AdSourceTypeKeyValue{Key: AdSourceTypeExchange, Value: "广告交易平台"}
)
func GetAllAdSourceTypeKeyValue() []AdSourceTypeKeyValue {
return []AdSourceTypeKeyValue{
AdSourceTypeSelfKeyValue,
AdSourceTypeThirdPartyKeyValue,
AdSourceTypeExchangeKeyValue,
}
}
var adSourceTypeValueMap = map[AdSourceType]string{
AdSourceTypeSelf: AdSourceTypeSelfKeyValue.Value,
AdSourceTypeThirdParty: AdSourceTypeThirdPartyKeyValue.Value,
AdSourceTypeExchange: AdSourceTypeExchangeKeyValue.Value,
}
func GetAdSourceTypeValueByKey(key AdSourceType) (value string) {
value, exists := adSourceTypeValueMap[key]
if !exists {
value = "未知类型"
}
return
}

View File

@@ -0,0 +1,13 @@
package app
// AppStatus 应用状态
type AppStatus string
const (
AppStatusActive AppStatus = "active" // 启用
AppStatusInactive AppStatus = "inactive" // 停用
)
func (s AppStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,17 @@
package app
// AppType 应用类型
type AppType string
const (
AppTypeWeb AppType = "web" // Web应用
AppTypeMobile AppType = "mobile" // 移动应用
AppTypeMiniApp AppType = "mini_app" // 小程序
AppTypeH5 AppType = "h5" // H5应用
AppTypeDesktop AppType = "desktop" // 桌面应用
AppTypeThirdParty AppType = "third_party" // 第三方应用
)
func (s AppType) String() string {
return string(s)
}

View File

@@ -1,52 +0,0 @@
package consts
// AuthType 认证类型枚举
type AuthType string
const (
AuthTypeAPIKey AuthType = "api_key" // API密钥
AuthTypeOAuth AuthType = "oauth" // OAuth
AuthTypeBasic AuthType = "basic" // Basic认证
)
// GetAllAuthTypes 获取所有认证类型
func GetAllAuthTypes() []AuthType {
return []AuthType{
AuthTypeAPIKey,
AuthTypeOAuth,
AuthTypeBasic,
}
}
type AuthTypeKeyValue struct {
Key AuthType
Value string
}
var (
AuthTypeAPIKeyKeyValue = AuthTypeKeyValue{Key: AuthTypeAPIKey, Value: "API密钥"}
AuthTypeOAuthKeyValue = AuthTypeKeyValue{Key: AuthTypeOAuth, Value: "OAuth"}
AuthTypeBasicKeyValue = AuthTypeKeyValue{Key: AuthTypeBasic, Value: "Basic认证"}
)
func GetAllAuthTypeKeyValue() []AuthTypeKeyValue {
return []AuthTypeKeyValue{
AuthTypeAPIKeyKeyValue,
AuthTypeOAuthKeyValue,
AuthTypeBasicKeyValue,
}
}
var authTypeValueMap = map[AuthType]string{
AuthTypeAPIKey: AuthTypeAPIKeyKeyValue.Value,
AuthTypeOAuth: AuthTypeOAuthKeyValue.Value,
AuthTypeBasic: AuthTypeBasicKeyValue.Value,
}
func GetAuthTypeValueByKey(key AuthType) (value string) {
value, exists := authTypeValueMap[key]
if !exists {
value = "未知认证类型"
}
return
}

View File

@@ -1,57 +0,0 @@
package consts
// BiddingType 竞价类型枚举
type BiddingType string
const (
BiddingTypeCPM BiddingType = "cpm" // 千次展示成本
BiddingTypeCPC BiddingType = "cpc" // 每次点击成本
BiddingTypeCPA BiddingType = "cpa" // 每次行动成本
BiddingTypeRTB BiddingType = "rtb" // 实时竞价
)
// GetAllBiddingTypes 获取所有竞价类型
func GetAllBiddingTypes() []BiddingType {
return []BiddingType{
BiddingTypeCPM,
BiddingTypeCPC,
BiddingTypeCPA,
BiddingTypeRTB,
}
}
type BiddingTypeKeyValue struct {
Key BiddingType
Value string
}
var (
BiddingTypeCPMKeyValue = BiddingTypeKeyValue{Key: BiddingTypeCPM, Value: "千次展示成本"}
BiddingTypeCPCKeypValue = BiddingTypeKeyValue{Key: BiddingTypeCPC, Value: "每次点击成本"}
BiddingTypeCPAKeyValue = BiddingTypeKeyValue{Key: BiddingTypeCPA, Value: "每次行动成本"}
BiddingTypeRTBKeyValue = BiddingTypeKeyValue{Key: BiddingTypeRTB, Value: "实时竞价"}
)
func GetAllBiddingTypeKeyValue() []BiddingTypeKeyValue {
return []BiddingTypeKeyValue{
BiddingTypeCPMKeyValue,
BiddingTypeCPCKeypValue,
BiddingTypeCPAKeyValue,
BiddingTypeRTBKeyValue,
}
}
var biddingTypeValueMap = map[BiddingType]string{
BiddingTypeCPM: BiddingTypeCPMKeyValue.Value,
BiddingTypeCPC: BiddingTypeCPCKeypValue.Value,
BiddingTypeCPA: BiddingTypeCPAKeyValue.Value,
BiddingTypeRTB: BiddingTypeRTBKeyValue.Value,
}
func GetBiddingTypeValueByKey(key BiddingType) (value string) {
value, exists := biddingTypeValueMap[key]
if !exists {
value = "未知竞价类型"
}
return
}

View File

@@ -1,57 +0,0 @@
package consts
// BillingModel 计费模式枚举
type BillingModel string
const (
BillingModelCPM BillingModel = "cpm" // 千次展示成本
BillingModelCPC BillingModel = "cpc" // 每次点击成本
BillingModelCPA BillingModel = "cpa" // 每次行动成本
BillingModelRevShare BillingModel = "rev_share" // 收入分成
)
// GetAllBillingModels 获取所有计费模式
func GetAllBillingModels() []BillingModel {
return []BillingModel{
BillingModelCPM,
BillingModelCPC,
BillingModelCPA,
BillingModelRevShare,
}
}
type BillingModelKeyValue struct {
Key BillingModel
Value string
}
var (
BillingModelCPMKeyValue = BillingModelKeyValue{Key: BillingModelCPM, Value: "千次展示成本"}
BillingModelCPCKeypValue = BillingModelKeyValue{Key: BillingModelCPC, Value: "每次点击成本"}
BillingModelCPAKeyValue = BillingModelKeyValue{Key: BillingModelCPA, Value: "每次行动成本"}
BillingModelRevShareKeyValue = BillingModelKeyValue{Key: BillingModelRevShare, Value: "收入分成"}
)
func GetAllBillingModelKeyValue() []BillingModelKeyValue {
return []BillingModelKeyValue{
BillingModelCPMKeyValue,
BillingModelCPCKeypValue,
BillingModelCPAKeyValue,
BillingModelRevShareKeyValue,
}
}
var billingModelValueMap = map[BillingModel]string{
BillingModelCPM: BillingModelCPMKeyValue.Value,
BillingModelCPC: BillingModelCPCKeypValue.Value,
BillingModelCPA: BillingModelCPAKeyValue.Value,
BillingModelRevShare: BillingModelRevShareKeyValue.Value,
}
func GetBillingModelValueByKey(key BillingModel) (value string) {
value, exists := billingModelValueMap[key]
if !exists {
value = "未知计费模式"
}
return
}

View File

@@ -1,18 +0,0 @@
package consts
// MongoDB集合名称常量
const (
AdPositionCollection = "ad_position" // 广告位集合
AdSourceCollection = "ad_source" // 广告源集合
AdvertisementCollection = "advertisement" // 广告集合
AdvertiserCollection = "advertiser" // 广告主集合
ApplicationCollection = "application" // 应用集合
CidRequestCollection = "cid_request" // CID请求集合
StrategyCollection = "strategy" // 策略集合
AdCreativeCollection = "ad_creative" // 广告创意集合
AdPlatformCollection = "ad_platform" // 广告平台集合
AdTypeCollection = "ad_type" // 广告类型集合
AppPlatformConfigCollection = "app_platform_config" // 应用平台配置集合
PlatformDeliveryRuleCollection = "platform_delivery_rule" // 平台投放规则集合
TargetingCollection = "targeting" // 定向规则集合
)

View File

@@ -1,19 +0,0 @@
package consts
// 默认配置值
const (
DefaultTimeout = 5000 // 默认超时时间(毫秒)
DefaultRetryCount = 3 // 默认重试次数
DefaultPriority = 1 // 默认优先级
)
// 错误消息
const (
ErrAdSourceNotFound = "广告源不存在"
ErrAdSourceNameExists = "广告源名称已存在"
ErrAdSourceCodeExists = "广告源编码已存在"
ErrAdSourceInactive = "广告源非活跃状态"
ErrAdSourceUnhealthy = "广告源健康状态异常"
ErrRateLimitExceeded = "请求频率超限"
ErrInvalidConfiguration = "配置参数无效"
)

View File

@@ -1,16 +0,0 @@
package consts
// 注意:以下枚举常量已迁移到单独的枚举文件中,请使用新的枚举类型:
// - AdSourceStatus -> consts.AdSourceStatus (ad_source_status.go)
// - AdSourceHealth -> consts.AdSourceHealth (ad_source_health.go)
// - AdSourceType -> consts.AdSourceType (ad_source_type.go)
// - AdSourceProvider -> consts.AdSourceProvider (ad_source_provider.go)
// - AuthType -> consts.AuthType (auth_type.go)
// - BiddingType -> consts.BiddingType (bidding_type.go)
// - AdFormatType -> consts.AdFormatType (ad_format_type.go)
// - BillingModel -> consts.BillingModel (billing_model.go)
// - PaymentTerms -> consts.PaymentTerms (payment_terms.go)
// 配置值常量已迁移到 config.go 文件中
// 错误消息常量已迁移到 config.go 文件中
// MongoDB集合名称常量已迁移到 collections.go 文件中

18
consts/data/api_method.go Normal file
View File

@@ -0,0 +1,18 @@
package data
// ApiMethod 接口请求方法
type ApiMethod string
const (
ApiMethodGet ApiMethod = "GET" // GET请求
ApiMethodPost ApiMethod = "POST" // POST请求
ApiMethodPut ApiMethod = "PUT" // PUT请求
ApiMethodDelete ApiMethod = "DELETE" // DELETE请求
ApiMethodPatch ApiMethod = "PATCH" // PATCH请求
ApiMethodHead ApiMethod = "HEAD" // HEAD请求
ApiMethodOptions ApiMethod = "OPTIONS" // OPTIONS请求
)
func (m ApiMethod) String() string {
return string(m)
}

View File

@@ -0,0 +1,16 @@
package data
// FetchStatus 数据获取状态
type FetchStatus string
const (
FetchStatusPending FetchStatus = "pending" // 待执行
FetchStatusRunning FetchStatus = "running" // 执行中
FetchStatusSuccess FetchStatus = "success" // 成功
FetchStatusFailed FetchStatus = "failed" // 失败
FetchStatusRateLimit FetchStatus = "rate_limit" // 触发限流
)
func (f FetchStatus) String() string {
return string(f)
}

14
consts/data/limit_type.go Normal file
View File

@@ -0,0 +1,14 @@
package data
// LimitType 限流类型
type LimitType string
const (
LimitTypeApp LimitType = "app" // 应用维度限流
LimitTypeTenant LimitType = "tenant" // 租户维度限流
LimitTypeApi LimitType = "api" // 接口维度限流
)
func (l LimitType) String() string {
return string(l)
}

View File

@@ -0,0 +1,13 @@
package data
// PlatformStatus 平台状态
type PlatformStatus string
const (
PlatformStatusActive PlatformStatus = "active" // 启用
PlatformStatusInactive PlatformStatus = "inactive" // 停用
)
func (s PlatformStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,21 @@
package data
// SyncPlatform 同步平台类型
type SyncPlatform string
const (
PlatformTaobao SyncPlatform = "taobao" // 淘宝
PlatformJD SyncPlatform = "jd" // 京东
PlatformKuaishou SyncPlatform = "kuaishou" // 快手
PlatformDouyin SyncPlatform = "douyin" // 抖音
PlatformXhs SyncPlatform = "xhs" // 小红书
PlatformPdd SyncPlatform = "pdd" // 拼多多
PlatformXianyu SyncPlatform = "xianyu" // 闲鱼
PlatformTmall SyncPlatform = "tmall" // 天猫
PlatformWechat SyncPlatform = "wechat" // 微信
PlatformCustom SyncPlatform = "custom" // 自定义平台
)
func (s SyncPlatform) String() string {
return string(s)
}

View File

@@ -1,56 +0,0 @@
package consts
import "errors"
// 广告管理错误码
const (
ErrAdNotFound = 1001 // 广告不存在
ErrAdStatusInvalid = 1002 // 广告状态无效
ErrAdAuditedRejected = 1003 // 广告审核被拒绝
ErrAdBudgetInsufficient = 1004 // 广告预算不足
)
// 广告主管理错误码
const (
ErrAdvertiserNotFound = 2001 // 广告主不存在
ErrAdvertiserStatusInvalid = 2002 // 广告主状态无效
ErrAdvertiserAuditedRejected = 2003 // 广告主审核被拒绝
ErrAdvertiserBalanceLow = 2004 // 广告主余额不足
ErrCreditLimitInvalid = 2005 // 授信额度无效
)
// 广告位管理错误码
const (
ErrAdPositionNotFound = 3001 // 广告位不存在
ErrAdPositionStatusInvalid = 3002 // 广告位状态无效
ErrAdPositionCodeExists = 3003 // 广告位编码已存在
ErrAdNotMatched = 3004 // 无匹配广告
)
// 报表管理错误码
const (
ErrReportNotFound = 4001 // 报表不存在
ErrReportNotGenerated = 4002 // 报表未生成
ErrReportExpired = 4003 // 报表已过期
ErrReportInvalidFormat = 4004 // 报表格式无效
)
// 配置验证错误
var (
ErrInvalidPriority = errors.New("优先级必须为非负数")
ErrInvalidWeight = errors.New("权重必须在0到1之间")
ErrInvalidBidAmount = errors.New("出价金额必须为非负数")
ErrInvalidBidRange = errors.New("最小出价不能大于最大出价")
ErrInvalidROAS = errors.New("ROAS必须为非负数")
ErrInvalidBudget = errors.New("预算金额必须为非负数")
ErrInvalidTimeRange = errors.New("开始时间不能大于结束时间")
ErrInvalidTimeout = errors.New("超时时间必须为正数")
ErrInvalidRetryCount = errors.New("重试次数必须为非负数")
ErrInvalidFileSize = errors.New("文件大小必须为正数")
ErrInvalidDuration = errors.New("时长必须为正数")
ErrInvalidRateLimit = errors.New("速率限制必须为正数")
ErrInvalidCommission = errors.New("佣金比例必须在0到1之间")
ErrInvalidRevShare = errors.New("收入分成比例必须在0到1之间")
ErrInvalidAge = errors.New("年龄必须为正数且最小年龄不能大于最大年龄")
ErrInvalidFrequency = errors.New("频次限制必须为非负数")
)

View File

@@ -0,0 +1,13 @@
package mapping
// MappingStatus 映射状态
type MappingStatus string
const (
MappingStatusActive MappingStatus = "active" // 启用
MappingStatusInactive MappingStatus = "inactive" // 停用
)
func (s MappingStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,16 @@
package mapping
// TransformType 转换类型
type TransformType string
const (
TransformTypeFixed TransformType = "fixed" // 固定值
TransformTypeMapping TransformType = "mapping" // 值映射
TransformTypeRegex TransformType = "regex" // 正则转换
TransformTypeFunction TransformType = "function" // 函数转换
TransformTypeScript TransformType = "script" // 脚本转换
)
func (t TransformType) String() string {
return string(t)
}

View File

@@ -1,52 +0,0 @@
package consts
// PaymentTerms 支付条款枚举
type PaymentTerms string
const (
PaymentTermsNet30 PaymentTerms = "net_30" // 30天
PaymentTermsNet60 PaymentTerms = "net_60" // 60天
PaymentTermsNet90 PaymentTerms = "net_90" // 90天
)
// GetAllPaymentTerms 获取所有支付条款
func GetAllPaymentTerms() []PaymentTerms {
return []PaymentTerms{
PaymentTermsNet30,
PaymentTermsNet60,
PaymentTermsNet90,
}
}
type PaymentTermsKeyValue struct {
Key PaymentTerms
Value string
}
var (
PaymentTermsNet30KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet30, Value: "30天"}
PaymentTermsNet60KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet60, Value: "60天"}
PaymentTermsNet90KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet90, Value: "90天"}
)
func GetAllPaymentTermsKeyValue() []PaymentTermsKeyValue {
return []PaymentTermsKeyValue{
PaymentTermsNet30KeyValue,
PaymentTermsNet60KeyValue,
PaymentTermsNet90KeyValue,
}
}
var paymentTermsValueMap = map[PaymentTerms]string{
PaymentTermsNet30: PaymentTermsNet30KeyValue.Value,
PaymentTermsNet60: PaymentTermsNet60KeyValue.Value,
PaymentTermsNet90: PaymentTermsNet90KeyValue.Value,
}
func GetPaymentTermsValueByKey(key PaymentTerms) (value string) {
value, exists := paymentTermsValueMap[key]
if !exists {
value = "未知支付条款"
}
return
}

View File

@@ -0,0 +1,10 @@
package public
// PostgreSQL表名常量
const (
PlatformTable = "cid_platform" // 平台管理表
ApiInterfaceTable = "cid_api_interface" // 接口管理表
DataFetchLogTable = "cid_data_fetch_log" // 数据获取日志表
DataMappingTable = "cid_data_mapping" // 数据映射表
ApplicationTable = "cid_application" // 应用管理表
)

View File

@@ -1,31 +0,0 @@
package consts
const (
AdRequestLimitKeyPrefix = "ad_request_limit:" // 广告请求限流键前缀
RateLimitKeyPrefix = "rate_limit:" // 通用限流键前缀
SessionCacheKeyPrefix = "session_cache:" // 会话缓存键前缀
)
// 广告缓存键
const (
AdCacheKeyPrefix = "cid:ad:" // 广告缓存前缀
AdPositionCacheKeyPrefix = "cid:pos:" // 广告位缓存前缀
AdvertiserCacheKeyPrefix = "cid:adv:" // 广告主缓存前缀
)
// 广告匹配键
const (
AdMatchingKeyPrefix = "cid:match:" // 广告匹配键前缀
UserProfileKeyPrefix = "cid:user:" // 用户画像键前缀
)
// 限流键
const (
ApiRequestLimitKeyPrefix = "cid:limit:api:" // API请求限流键前缀
)
// Stream键
const (
AdEventStreamKey = "cid:stream:ad_event" // 广告事件流
UserBehaviorStreamKey = "cid:stream:user_behavior" // 用户行为流
)