Initial commit: web_hghl_server

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 16:28:14 +08:00
co-authored by Claude Opus 4.7
commit 65fca60622
653 changed files with 135901 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"github.com/gin-gonic/gin"
"videoweb/web/api/web_actress"
)
func actressRouter(router *gin.RouterGroup) {
post := router.Group("/actress")
{
post.GET("/list", web_actress.Get)
post.POST("/update", web_actress.Update)
post.POST("/del", web_actress.Del)
post.POST("/add", web_actress.Add)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"videoweb/web/api/web_announcement"
"github.com/gin-gonic/gin"
)
func announcementRouter(router *gin.RouterGroup) {
group := router.Group("/announcement")
{
group.POST("/list", web_announcement.AnnouncementList)
group.POST("/add", web_announcement.AnnouncementAdd)
group.POST("/del", web_announcement.AnnouncementDel)
group.POST("/update", web_announcement.AnnouncementUpdate)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"github.com/gin-gonic/gin"
"videoweb/web/api/web_app"
)
func appSyncRouter(router *gin.RouterGroup) {
sync := router.Group("/sync")
{
sync.POST("/video/list", web_app.AppSyncReq)
sync.POST("/videocollection/list", web_app.AppCollectionSyncReq)
sync.POST("/category/list", web_app.AppGetVideoCategory)
sync.POST("/creator/list", web_app.AppGetVideoCreator)
sync.POST("/tag/list", web_app.AppGetVideoTag)
}
}
+23
View File
@@ -0,0 +1,23 @@
package router
import (
webanalytics "videoweb/web/api/web_analytics"
"videoweb/web/api/web_cfg"
"github.com/gin-gonic/gin"
)
func syscfgRouter(router *gin.RouterGroup) {
system := router.Group("/syscfg")
{
system.GET("/get", web_cfg.GetCfg)
system.POST("/update", web_cfg.UpdateCfg)
system.POST("/appkey", web_cfg.SetAppKey)
}
stat := router.Group("/stat")
{
stat.GET("/analytics", webanalytics.GetAnalyticsStat)
stat.GET("/daily/analytics", webanalytics.GetAnalyticsDailyStat)
}
}
+19
View File
@@ -0,0 +1,19 @@
package router
import (
"videoweb/web/api/web_commend"
"github.com/gin-gonic/gin"
)
func commentRouter(router *gin.RouterGroup) {
group := router.Group("/post")
{
group.POST("/comment/list", web_commend.SearchManyCommend)
group.POST("/comment/replay", web_commend.ReplayPostComment)
group.POST("/comment/del", web_commend.DelCommend)
group.POST("/comment/user/del", web_commend.DelUserCommend)
group.POST("/comment/reviewBatch", web_commend.ReviewCommendBatch)
group.POST("/comment/review", web_commend.ReviewComment)
}
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"videoweb/web/api/web_contactus"
"github.com/gin-gonic/gin"
)
func contactusRouter(router *gin.RouterGroup) {
group := router.Group("/contactus")
{
group.POST("/list", web_contactus.ContactusList)
group.POST("/del", web_contactus.Del)
group.POST("/update", web_contactus.Update)
}
}
+18
View File
@@ -0,0 +1,18 @@
package router
import (
"videoweb/web/api/web_contenttag"
"github.com/gin-gonic/gin"
)
func contentTagRouter(router *gin.RouterGroup) {
group := router.Group("/content/tag")
{
group.GET("/list", web_contenttag.List)
group.GET("/option", web_contenttag.Option)
group.POST("/add", web_contenttag.Add)
group.POST("/update", web_contenttag.Update)
group.POST("/del", web_contenttag.Del)
}
}
+15
View File
@@ -0,0 +1,15 @@
package router
import (
"videoweb/web/api/web_contentexcel"
"github.com/gin-gonic/gin"
)
func contentExcelRouter(rootRouter *gin.RouterGroup) {
group := rootRouter.Group("/contentexcel")
{
group.GET("/export", web_contentexcel.Export)
group.POST("/import", web_contentexcel.Import)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"videoweb/web/api/web_detailnav"
"github.com/gin-gonic/gin"
)
func detailNavRouter(router *gin.RouterGroup) {
group := router.Group("/detailnav")
{
group.POST("/list", web_detailnav.DetailNavList)
group.POST("/add", web_detailnav.DetailNavAdd)
group.POST("/del", web_detailnav.DetailNavDel)
group.POST("/update", web_detailnav.DetailNavUpdate)
}
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"videoweb/web/api/web_file"
"github.com/gin-gonic/gin"
)
func fileRouter(router *gin.RouterGroup) {
// 文件上传
file := router.Group("/file")
{
file.POST("/uploadImg", web_file.UploadImage)
file.POST("/uploadImgs", web_file.UploadImages)
}
}
+122
View File
@@ -0,0 +1,122 @@
package router
import (
"fmt"
"net/http"
"videoweb/pub/common/errors"
"videoweb/pub/common/log"
"videoweb/pub/common/useragent"
"videoweb/web/middleware/auth"
"videoweb/web/middleware/cors"
"videoweb/web/middleware/ipblacklist"
"videoweb/web/middleware/limitHandler"
"videoweb/web/webg"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/DeanThompson/ginpprof"
"github.com/gin-gonic/gin"
_ "videoweb/web/docs"
)
func Init() (engine *gin.Engine) {
// 设置启动模式
switch webg.Conf.RunMod {
case "dev":
gin.SetMode(gin.DebugMode)
case "test":
gin.SetMode(gin.TestMode)
case "prod":
gin.SetMode(gin.ReleaseMode)
default:
gin.SetMode(gin.DebugMode)
}
// 初始化gin引擎
engine = gin.Default()
engine.HandleMethodNotAllowed = true
engine.MaxMultipartMemory = 60 << 20
engine.NoMethod(noMethod)
engine.NoRoute(noRoute)
// 注册中间件
registeMiddleware(engine)
wbVideoDataRouter(engine)
registerRouter(engine)
log.Info("setGinSwaggerxxxxx")
if webg.Conf.RunMod != "prod" {
log.Info("setGinSwagger")
setGinSwagger(engine)
log.Info("setGinSwagger end")
}
// 是否开启监控服务
if webg.Conf.Pprof {
ginpprof.Wrap(engine)
}
return
}
func noMethod(c *gin.Context) {
c.JSON(http.StatusMethodNotAllowed, errors.MakeWithMsg(errors.MethodNotFound, "MethodNotFound"))
}
func noRoute(c *gin.Context) {
c.JSON(http.StatusNotFound, errors.MakeWithMsg(errors.ApiNotFound, "ApiNotFound"))
}
func registeMiddleware(engine *gin.Engine) {
engine.Use(gin.Recovery())
engine.Use(cors.Cors(&cors.Options{
Origin: nil, // "*"
Methods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodHead, http.MethodDelete},
AllowedHeaders: []string{"Content-Length", "Content-Type", "Authorization", "X-User-Agent", useragent.SDKCommonHeader},
ExposedHeaders: []string{"Content-Disposition", "Refresh-Authorization"},
OptionsSuccessStatus: http.StatusOK,
}))
engine.Use(ipblacklist.IpBlackListMiddleware)
engine.Use(auth.Auth)
engine.Use(limitHandler.LoginLimit)
engine.Use(auth.OperateLog)
}
// 设置swag 接口信息
func setGinSwagger(router *gin.Engine) {
url := ginSwagger.URL(fmt.Sprintf("http://%s:%s/swagger/doc.json", webg.Conf.Host, webg.Conf.ListenAddr))
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
}
func registerRouter(router *gin.Engine) {
rootRouter := router.Group("/api/web")
{
MainWebRouter(rootRouter)
syscfgRouter(rootRouter)
fileRouter(rootRouter)
videoRouter(rootRouter)
translationRouter(rootRouter)
richTextContent(rootRouter)
commentRouter(rootRouter)
videoCollectionRouter(rootRouter)
ipBlackRouter(rootRouter)
detailNavRouter(rootRouter)
mediaResourceRouter(rootRouter)
playletRouter(rootRouter)
homeBannerRouter(rootRouter)
contentTagRouter(rootRouter)
slugRouter(rootRouter)
hotNavRouter(rootRouter)
appSyncRouter(rootRouter)
actressRouter(rootRouter)
contactusRouter(rootRouter)
announcementRouter(rootRouter)
userRouter(rootRouter)
questionnaireRouter(rootRouter)
contentExcelRouter(rootRouter)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"videoweb/web/api/web_homebanner"
"github.com/gin-gonic/gin"
)
func homeBannerRouter(router *gin.RouterGroup) {
group := router.Group("/home/banner")
{
group.GET("/list", web_homebanner.List)
group.POST("/add", web_homebanner.Add)
group.POST("/update", web_homebanner.Update)
group.POST("/del", web_homebanner.Del)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"videoweb/web/api/web_hotnav"
"github.com/gin-gonic/gin"
)
func hotNavRouter(router *gin.RouterGroup) {
group := router.Group("/hotnav")
{
group.POST("/list", web_hotnav.HotNavList)
group.POST("/add", web_hotnav.HotNavAdd)
group.POST("/del", web_hotnav.HotNavDel)
group.POST("/update", web_hotnav.HotNavUpdate)
}
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"github.com/gin-gonic/gin"
"videoweb/web/api/web_ipblack"
)
func ipBlackRouter(router *gin.RouterGroup) {
// 文件上传
group := router.Group("/ipblack")
{
group.POST("/list", web_ipblack.IpBlackList)
group.POST("/add", web_ipblack.IpBlackAdd)
group.POST("/del", web_ipblack.IpBlackDel)
}
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"videoweb/web/api/web_mediaresource"
"github.com/gin-gonic/gin"
)
func mediaResourceRouter(router *gin.RouterGroup) {
group := router.Group("/resource")
{
group.GET("/list", web_mediaresource.ResourceList)
group.GET("/chapters", web_mediaresource.ResourceChapters)
group.POST("/import", web_mediaresource.ResourceImport)
}
}
+52
View File
@@ -0,0 +1,52 @@
package router
import (
"videoweb/web/api/web_playlet"
"github.com/gin-gonic/gin"
)
func playletRouter(router *gin.RouterGroup) {
group := router.Group("/playlet")
{
group.GET("/list", web_playlet.List)
group.POST("/add", web_playlet.Add)
group.POST("/update", web_playlet.Update)
group.POST("/del", web_playlet.Del)
group.POST("/status/set", web_playlet.SetStatus)
group.POST("/recommend/set", web_playlet.SetRecommend)
group.POST("/featured/set", web_playlet.SetFeatured)
group.POST("/banner/set", web_playlet.SetBanner)
group.POST("/category/set", web_playlet.SetCategory)
group.POST("/theme/set", web_playlet.SetTheme)
group.POST("/tag/set", web_playlet.SetTag)
group.POST("/like/virtual/set", web_playlet.SetVirtualLike)
group.POST("/browse/virtual/set", web_playlet.SetVirtualBrowse)
group.POST("/heat/virtual/set", web_playlet.SetVirtualHeat)
group.POST("/pay-type/set", web_playlet.SetPayType)
group.POST("/watermark/reset", web_playlet.ResetWatermark)
group.GET("/chapter/list", web_playlet.ChapterList)
group.POST("/chapter/add", web_playlet.ChapterAdd)
group.POST("/chapter/update", web_playlet.ChapterUpdate)
group.POST("/chapter/del", web_playlet.ChapterDel)
group.POST("/chapter/sync", web_playlet.ChapterSync)
group.POST("/chapter/pay-type/set", web_playlet.ChapterSetPayType)
group.GET("/category/list", web_playlet.CategoryList)
group.POST("/category/add", web_playlet.CategoryAdd)
group.POST("/category/update", web_playlet.CategoryUpdate)
group.POST("/category/del", web_playlet.CategoryDel)
group.GET("/tag/list", web_playlet.TagList)
group.POST("/tag/add", web_playlet.TagAdd)
group.POST("/tag/update", web_playlet.TagUpdate)
group.POST("/tag/del", web_playlet.TagDel)
group.GET("/theme/list", web_playlet.ThemeList)
group.POST("/theme/add", web_playlet.ThemeAdd)
group.POST("/theme/update", web_playlet.ThemeUpdate)
group.POST("/theme/del", web_playlet.ThemeDel)
group.GET("/home-config/list", web_playlet.HomeConfigList)
group.GET("/home-config/topic/options", web_playlet.HomeConfigTopicOptions)
group.POST("/home-config/add", web_playlet.HomeConfigAdd)
group.POST("/home-config/update", web_playlet.HomeConfigUpdate)
group.POST("/home-config/del", web_playlet.HomeConfigDel)
}
}
+15
View File
@@ -0,0 +1,15 @@
package router
import (
"videoweb/web/api/web_questionnaire"
"github.com/gin-gonic/gin"
)
func questionnaireRouter(router *gin.RouterGroup) {
group := router.Group("/questionnaire")
{
group.POST("/list", web_questionnaire.List)
group.POST("/handle", web_questionnaire.Handle)
}
}
+17
View File
@@ -0,0 +1,17 @@
package router
import (
"github.com/gin-gonic/gin"
"videoweb/web/api/web_richtextcontent"
)
func richTextContent(router *gin.RouterGroup) {
// 文件上传
file := router.Group("/richtextcontent")
{
file.POST("/list", web_richtextcontent.List)
file.POST("/add", web_richtextcontent.Add)
file.POST("/del", web_richtextcontent.Del)
file.POST("/update", web_richtextcontent.Update)
}
}
+14
View File
@@ -0,0 +1,14 @@
package router
import (
"videoweb/web/api/web_slug"
"github.com/gin-gonic/gin"
)
func slugRouter(router *gin.RouterGroup) {
group := router.Group("/slug")
{
group.POST("/sync", web_slug.SyncSlug)
}
}
+42
View File
@@ -0,0 +1,42 @@
package router
import (
"videoweb/web/api/web_acc"
"github.com/gin-gonic/gin"
)
// 主后台路由
func MainWebRouter(router *gin.RouterGroup) {
login := router.Group("/login")
{
login.POST("/acc", web_acc.AccLogin)
login.POST("/bind", web_acc.BindQurl)
login.POST("/slogin", web_acc.SLogin)
}
role := router.Group("/role")
{
role.GET("/list", web_acc.RoleGetList)
role.POST("/add", web_acc.RoleAdd)
role.POST("/del", web_acc.RoleDel)
role.GET("/getinfo", web_acc.RoleGetInfo)
role.POST("/up", web_acc.RoleUp)
role.POST("/enable", web_acc.RoleEnable)
role.POST("/drop", web_acc.RoleGetDrop)
role.GET("/getauth", web_acc.RoleGetAuth)
role.POST("/upauth", web_acc.RoleUpAuth)
}
acc := router.Group("/acc")
{
acc.GET("/list", web_acc.AccGetList)
acc.POST("/add", web_acc.AccAdd)
acc.POST("/del", web_acc.AccDel)
acc.GET("/getinfo", web_acc.AccGetInfo)
acc.POST("/up", web_acc.AccUp)
acc.GET("/getstatus", web_acc.AccGetStatus)
acc.POST("/savestatus", web_acc.AccSaveStatus)
acc.POST("/ops", web_acc.GetAccOpRecords)
acc.POST("/uppwd", web_acc.AccUpdatePwd)
}
}
+24
View File
@@ -0,0 +1,24 @@
package router
import (
"videoweb/web/api/web_translation"
"github.com/gin-gonic/gin"
)
func translationRouter(router *gin.RouterGroup) {
translation := router.Group("/translation")
{
translation.POST("/list", web_translation.GetTranslation)
translation.POST("/update", web_translation.UpdateOnetTranslation)
translation.POST("/del", web_translation.DelOnetTranslation)
translation.POST("/add", web_translation.AddOnetTranslation)
}
translationcategory := router.Group("/translationcategory")
{
translationcategory.POST("/list", web_translation.GetTranslationCategory)
translationcategory.POST("/update", web_translation.UpdateOnetTranslationCategory)
translationcategory.POST("/del", web_translation.DelOnetTranslationCategory)
translationcategory.POST("/add", web_translation.AddOnetTranslationCategory)
}
}
+15
View File
@@ -0,0 +1,15 @@
package router
import (
"videoweb/web/api/web_user"
"github.com/gin-gonic/gin"
)
func userRouter(router *gin.RouterGroup) {
user := router.Group("/user")
{
user.POST("/list", web_user.GetUserList)
user.POST("/update", web_user.UpdateUser)
}
}
+54
View File
@@ -0,0 +1,54 @@
package router
import (
"videoweb/web/api/web_video"
"github.com/gin-gonic/gin"
)
func videoRouter(router *gin.RouterGroup) {
advitise := router.Group("/videoinfo")
{
advitise.POST("/list", web_video.GetVideoInfo)
advitise.POST("/update", web_video.UpdateOneVideoInfo)
advitise.POST("/del", web_video.DelOneVideoInfo)
advitise.POST("/sync", web_video.SyncVideoInfo)
advitise.POST("/syncMediaFile", web_video.SyncVideoFromMediaFile)
advitise.POST("/addcoll", web_video.AddOneVideoCollection)
advitise.POST("/addTags", web_video.AddVideoTags)
advitise.POST("/tag/set", web_video.SetVideoTags)
advitise.POST("/recommend/set", web_video.SetVideoRecommend)
advitise.POST("/setFakeLikes", web_video.SetVideoFakeLikes)
advitise.POST("/setFakeWatchTimes", web_video.SetVideoFakeWatchTimes)
advitise.POST("/heat/set", web_video.SetVideoHeat)
advitise.POST("/fillZeroFakeFlow", web_video.FillZeroVideoFakeFlow)
}
videocategory := router.Group("/videocategory")
{
videocategory.POST("/list", web_video.GetVideoCategory)
videocategory.POST("/update", web_video.UpdateOneVideoCategory)
videocategory.POST("/del", web_video.DelOneVideoCategory)
videocategory.POST("/add", web_video.AddOneVideoCategory)
}
videotag := router.Group("/videotag")
{
videotag.POST("/list", web_video.GetVideoTagInfo)
videotag.POST("/update", web_video.UpdateOneVideoTagInfo)
videotag.POST("/del", web_video.DelOneVideoTagInfo)
videotag.POST("/add", web_video.AddOneVideoTagInfo)
}
videocreater := router.Group("/videocreater")
{
videocreater.POST("/list", web_video.GetVideoCreater)
videocreater.POST("/update", web_video.UpdateOneVideoCreater)
videocreater.POST("/del", web_video.DelOneVideoCreater)
videocreater.POST("/add", web_video.AddOneVideoCreater)
}
router.GET("/m3u8/*key", web_video.Play)
router.GET("/transm3u8/*key", web_video.TranscodeM3u8)
router.GET("/enkey", web_video.Enkey)
router.GET("/lsjenkey", web_video.LsjEnkey)
router.POST("/videoinfo/transcode", web_video.TranscodeVideo)
}
+15
View File
@@ -0,0 +1,15 @@
package router
import (
"github.com/gin-gonic/gin"
"videoweb/web/api/web_videocollection"
)
func videoCollectionRouter(router *gin.RouterGroup) {
group := router.Group("/videocollection")
{
group.POST("/media/list", web_videocollection.GetVideoCollectionMediaList)
group.POST("/media/option", web_videocollection.UpdateVideoCollectionMediaList)
group.POST("/media/rank", web_videocollection.UpdateVideoCollectionMediaRank)
}
}
+18
View File
@@ -0,0 +1,18 @@
package router
import (
"videoweb/web/api/web_video"
"videoweb/web/middleware/apilimitHandler"
"github.com/gin-gonic/gin"
)
func wbVideoDataRouter(r *gin.Engine) {
limiter := apilimitHandler.NewRouteHourlyLimiter(100)
router := r.Group("/wbapi/hjsq")
{
router.Use(limiter.Middleware())
router.GET("/hottag", web_video.GetVideoPlayData)
router.GET("/ipstat", web_video.GetIpStatData)
}
}