init: 初始化 web_hgdjb_server 项目
Co-Authored-By: Claude Opus 4.7 <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/translationcategorymod"
|
||||
"videoweb/web/service/srv_translationcategory"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 导航分类
|
||||
// @Summary 分组分页获取导航分类
|
||||
// @Description 分组分页获取导航分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_translationcategory.TranslationCategoryReq true "参数列表"
|
||||
// @Success 200 {object} srv_translationcategory.TranslationCategoryResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/translationcategory/list [POST]
|
||||
func GetTranslationCategory(ctx *gin.Context) {
|
||||
var req = &srv_translationcategory.TranslationCategoryReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, serr := srv_translationcategory.GetTranslationCategorys(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 translationcategorymod.TranslationCategory true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/translationcategory/add [POST]
|
||||
func AddOnetTranslationCategory(ctx *gin.Context) {
|
||||
var req = &translationcategorymod.TranslationCategory{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
serr := srv_translationcategory.AddTranslationCategory(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_translationcategory.TranslationCategoryDelReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/translationcategory/del [POST]
|
||||
func DelOnetTranslationCategory(ctx *gin.Context) {
|
||||
var req = &srv_translationcategory.TranslationCategoryDelReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
serr := srv_translationcategory.DelTranslationCategory(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_translationcategory.TranslationCategoryUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/translationcategory/update [POST]
|
||||
func UpdateOnetTranslationCategory(ctx *gin.Context) {
|
||||
var req = &srv_translationcategory.TranslationCategoryUpdateReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
serr := srv_translationcategory.UpdateTranslationCategory(ctx, req.Id, req.Param)
|
||||
if serr != nil {
|
||||
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
||||
return
|
||||
}
|
||||
|
||||
common.ServerJSON(ctx, srvdef.Success, "")
|
||||
}
|
||||
@@ -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