Files

39 lines
1.2 KiB
Go

package consts
// AdState 广告状态枚举
type AdState int
const (
StateFetchFailed AdState = iota + 1 // 拉取失败
StateFetchSuccess // 拉取成功
StateDisplayFailed // 显示失败
StateDisplaySuccess // 显示成功
StateNotWatched // 未观看完成
StateWatched // 观看完成
StateNotClicked // 未点击
StateClicked // 已点击
StateNotDownloaded // 未下载
StateDownloaded // 已下载
)
// GetStateDescription 获取状态描述
func GetStateDescription(state AdState) string {
descriptions := map[AdState]string{
StateFetchFailed: "拉取失败",
StateFetchSuccess: "拉取成功",
StateDisplayFailed: "显示失败",
StateDisplaySuccess: "显示成功",
StateNotWatched: "未观看完成",
StateWatched: "观看完成",
StateNotClicked: "未点击",
StateClicked: "已点击",
StateNotDownloaded: "未下载",
StateDownloaded: "已下载",
}
if desc, exists := descriptions[state]; exists {
return desc
}
return "未知状态"
}