书籍列表接口新增参数
This commit is contained in:
38
internal/consts/ads.go
Normal file
38
internal/consts/ads.go
Normal file
@ -0,0 +1,38 @@
|
||||
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 "未知状态"
|
||||
}
|
||||
Reference in New Issue
Block a user