feat: 更新内容视图和编辑视图,支持动态曲种选项和标签显示

This commit is contained in:
2026-01-05 09:07:13 +08:00
parent 113f9c8d3c
commit 637ff7110d
3 changed files with 44 additions and 11 deletions

View File

@@ -20,6 +20,16 @@ import (
// @provider
type creator struct{}
var genreMap = map[string]string{
"Jingju": "京剧",
"Kunqu": "昆曲",
"Yueju": "越剧",
"Yuju": "豫剧",
"Huangmeixi": "黄梅戏",
"Pingju": "评剧",
"Qinqiang": "秦腔",
}
func (s *creator) Apply(ctx context.Context, userID int64, form *creator_dto.ApplyForm) error {
if userID == 0 {
return errorx.ErrUnauthorized
@@ -111,7 +121,12 @@ func (s *creator) ListContents(
q = q.Where(tbl.Status.Eq(consts.ContentStatus(*filter.Status)))
}
if filter.Genre != nil && *filter.Genre != "" {
q = q.Where(tbl.Genre.Eq(*filter.Genre))
val := *filter.Genre
if cn, ok := genreMap[val]; ok {
q = q.Where(tbl.Genre.In(val, cn))
} else {
q = q.Where(tbl.Genre.Eq(val))
}
}
if filter.Keyword != nil && *filter.Keyword != "" {
q = q.Where(tbl.Title.Like("%" + *filter.Keyword + "%"))