来源:hgdjnet-server 9bfbafe10d417deea959bd53117bc88a10e60a83 项目身份 HKDJ / JHA-216,独立官网仓库,Jenkins 守卫键 hkdjnet 测试目录 /server/hkdj_net,App/Web API 30331/30332 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
112 lines
3.3 KiB
Go
112 lines
3.3 KiB
Go
package web_translation
|
|
|
|
import (
|
|
"hkdj-web-server/pub/common"
|
|
"hkdj-web-server/pub/common/srvdef"
|
|
"hkdj-web-server/pub/models/translationmod"
|
|
"hkdj-web-server/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, "")
|
|
}
|