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

143 lines
4.5 KiB
Go

package dhapi
import (
"fmt"
"strconv"
"videoweb/app/api/proto"
"videoweb/app/service/configser"
"videoweb/app/service/searchser"
"videoweb/app/service/translationser"
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"github.com/gin-gonic/gin"
)
// DHApi 导航
// @Tags 导航
// @Summary 导航
// @Description 导航
// @Accept json
// @Produce json
// @Param param body string true "参数列表"
// @Success 200 {object} proto.DHHtmlData "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /dh [get]
func DHApi(c *gin.Context) {
data := proto.DHHtmlData{
Path: c.Request.URL.Path,
Translations: translationser.GetTranslationData(),
BottonTranslations: translationser.GetTranslationBottomList(),
Config: configser.GetRequestConfig(c),
HotNavs: configser.GetHotNavs(),
}
configser.RewriteImageCdn(c, &data)
common.JSONWriterCache(c, srvdef.Success, data)
}
// BusinessCooperationApi 导航
// @Tags 导航
// @Summary 导航
// @Description 导航
// @Accept json
// @Produce json
// @Param param body string true "参数列表"
// @Success 200 {object} proto.HomeHtmlData "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /businessCooperation [get]
func BusinessCooperationApi(c *gin.Context) {
data := proto.DHHtmlData{
Path: c.Request.URL.Path,
Translations: translationser.GetTranslationData(),
BottonTranslations: translationser.GetTranslationBottomList(),
Config: configser.GetRequestConfig(c),
Announcement: configser.GetAnnouncement(),
HotSearch: searchser.GetHotSearchItem(c),
Advitise: configser.GetAdvitise(),
}
data.CompletePath = "/businessCooperation"
configser.RewriteImageCdn(c, &data)
common.JSONWriterCache(c, srvdef.Success, data)
}
// ServicesProjectApi 导航
// @Tags 导航
// @Summary 导航
// @Description 导航
// @Accept json
// @Produce json
// @Param param body string true "参数列表"
// @Success 200 {object} proto.HomeHtmlData "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /servicesProject [get]
func ServicesProjectApi(c *gin.Context) {
data := proto.DHHtmlData{
Path: c.Request.URL.Path,
Translations: translationser.GetTranslationData(),
BottonTranslations: translationser.GetTranslationBottomList(),
Config: configser.GetRequestConfig(c),
Announcement: configser.GetAnnouncement(),
HotSearch: searchser.GetHotSearchItem(c),
Advitise: configser.GetAdvitise(),
}
data.CompletePath = "/servicesProject"
configser.RewriteImageCdn(c, &data)
common.JSONWriterCache(c, srvdef.Success, data)
}
// ConsultingApi 招募
// @Tags 招募
// @Summary 招募
// @Description 招募
// @Accept json
// @Produce json
// @Param param body string true "参数列表"
// @Success 200 {object} proto.HomeHtmlData "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /consulting [get]
func ConsultingApi(c *gin.Context) {
data := proto.DHConsultingHtmlData{
Path: c.Request.URL.Path,
Translations: translationser.GetTranslationData(),
BottonTranslations: translationser.GetTranslationBottomList(),
Config: configser.GetRequestConfig(c),
}
data.CompletePath = "/consulting"
configser.RewriteImageCdn(c, &data)
common.JSONWriterCache(c, srvdef.Success, data)
}
// ConsultingInfoApi 招募详情
// @Tags 招募详情
// @Summary 招募详情
// @Description 招募详情
// @Accept json
// @Produce json
// @Param param body string true "参数列表"
// @Success 200 {object} proto.HomeHtmlData "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /consultinginfo/:id [get]
func ConsultingInfoApi(c *gin.Context) {
data := proto.DHConsultingInfoHtmlData{
Path: c.Request.URL.Path,
Translations: translationser.GetTranslationData(),
BottonTranslations: translationser.GetTranslationBottomList(),
Config: configser.GetRequestConfig(c),
Announcement: configser.GetAnnouncement(),
HotSearch: searchser.GetHotSearchItem(c),
Advitise: configser.GetAdvitise(),
}
idStr := c.Param("id")
id, err := strconv.ParseInt(idStr, 10, 64)
if err == nil && id > 0 {
data.CompletePath = fmt.Sprintf("/consultingInfo/%d", id)
}
configser.RewriteImageCdn(c, &data)
common.JSONWriterCache(c, srvdef.Success, data)
}