Files
2026-10-26 16:28:14 +08:00

38 lines
1.2 KiB
Go

package web_slug
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/service/srv_slug"
"github.com/gin-gonic/gin"
)
// SyncSlug 补齐历史空 slug
// @Tags web slug相关接口
// @Summary 同步历史空 slug
// @Description 为视频、分类、女优、作者、短剧、统一标签等空 slug 按 SEO 关键词或名称自动生成。可重复调用,hasMore 为 true 时继续请求。type 为空处理全部,也可指定 video/videoCategory/actress/videoCreater/playlet/playletCategory/playletTheme/contentTag。
// @Accept json
// @Produce json
// @Param param body proto.SlugSyncReq false "同步参数"
// @Success 200 {object} proto.SlugSyncResp "成功"
// @Failure 400 {string} string "参数错误"
// @Security ApiKeyAuth
// @Router /api/web/slug/sync [POST]
func SyncSlug(ctx *gin.Context) {
var req proto.SlugSyncReq
if ctx.Request.ContentLength > 0 {
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
}
resp, serr := srv_slug.SyncEmptySlugs(ctx, &req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}