53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
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
|
|
}
|