Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
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, "")
|
||||
}
|
||||
Reference in New Issue
Block a user