Files
rootandClaude Opus 4.7 79ac89b458 Initial commit
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-11-07 10:47:18 +08:00

112 lines
3.3 KiB
Go

package web_translation
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/pub/models/translationmod"
"videoweb/web/service/srv_translation"
"github.com/gin-gonic/gin"
)
// @Tags 导航跳转信息
// @Summary 分组分页获取导航跳转信息
// @Description 分组分页获取导航跳转信息
// @Accept json
// @Produce json
// @Param param body srv_translation.TranslationInfoReq true "参数列表"
// @Success 200 {object} srv_translation.TranslationInfoResp "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/translation/list [POST]
func GetTranslation(ctx *gin.Context) {
var req = &srv_translation.TranslationInfoReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, serr := srv_translation.GetTranslationInfos(ctx, req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// @Tags 导航跳转信息
// @Summary 添加一个导航跳转信息
// @Description 添加一个导航跳转信息
// @Accept json
// @Produce json
// @Param param body translationmod.TranslationInfo true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/translation/add [POST]
func AddOnetTranslation(ctx *gin.Context) {
var req = &translationmod.TranslationInfo{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_translation.AddTranslationInfo(ctx, req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// @Tags 导航跳转信息
// @Summary 删除一个导航跳转信息
// @Description 删除一个导航跳转信息
// @Accept json
// @Produce json
// @Param param body srv_translation.TranslationInfoDelReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/translation/del [POST]
func DelOnetTranslation(ctx *gin.Context) {
var req = &srv_translation.TranslationInfoDelReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_translation.DelTranslationInfo(ctx, req.Id)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// @Tags 导航跳转信息
// @Summary 更新一个导航跳转信息
// @Description 更新一个导航跳转信息
// @Accept json
// @Produce json
// @Param param body srv_translation.TranslationInfoUpdateReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/translation/update [POST]
func UpdateOnetTranslation(ctx *gin.Context) {
var req = &srv_translation.TranslationInfoUpdateReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
serr := srv_translation.UpdateTranslationInfo(ctx, req.Id, req.Param)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}