优化mongo,封装count逻辑,处理objectId
This commit is contained in:
57
consts/bidding_type.go
Normal file
57
consts/bidding_type.go
Normal file
@@ -0,0 +1,57 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user