feat: live module and jenkins pipeline to harbor deploy

This commit is contained in:
Yvan
2026-09-21 16:45:44 +08:00
parent 451c8e2abc
commit 829d75c657
145 changed files with 8984 additions and 269 deletions
+10
View File
@@ -0,0 +1,10 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAnalytics(private *gin.RouterGroup, h *handler.Analytics) {
private.GET("/live/admin/dashboard", h.Dashboard)
}
+13
View File
@@ -0,0 +1,13 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAsset(private *gin.RouterGroup, h *handler.Asset) {
private.GET("/live/admin/users", h.List)
private.GET("/live/admin/users/:id", h.Get)
private.PATCH("/live/admin/users/:id/status", h.Status)
private.POST("/live/admin/users/:id/balance", h.Adjust)
}
+19
View File
@@ -0,0 +1,19 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterGift(public, private *gin.RouterGroup, h *handler.Gift) {
public.GET("/live/gifts", h.PublicList)
private.GET("/live/admin/gifts", h.List)
private.GET("/live/admin/gifts/:id", h.Get)
private.POST("/live/admin/gifts", h.Create)
private.PUT("/live/admin/gifts/:id", h.Update)
private.DELETE("/live/admin/gifts/:id", h.Delete)
private.PATCH("/live/admin/gifts/:id/status", h.Status)
private.PUT("/live/admin/gifts/sort", h.Sort)
private.GET("/live/admin/sends", h.Sends)
private.POST("/live/rooms/:id/gifts", h.Send)
}
+27
View File
@@ -0,0 +1,27 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterLive(public, private *gin.RouterGroup, h *handler.Live) {
public.GET("/live/streams", h.List)
public.GET("/live/streams/:streamId", h.Find)
// Keep the old list endpoint as a compatibility alias for existing clients.
public.GET("/api/streams", h.LegacyList)
public.GET("/live/categories", h.PublicCategories)
public.GET("/live/rooms", h.PublicRooms)
public.GET("/live/rooms/:id", h.GetRoom)
private.GET("/live/admin/categories", h.ListCategories)
private.POST("/live/admin/categories", h.CreateCategory)
private.PUT("/live/admin/categories/:id", h.UpdateCategory)
private.DELETE("/live/admin/categories/:id", h.DeleteCategory)
private.GET("/live/admin/rooms", h.ListRooms)
private.GET("/live/admin/rooms/:id", h.GetRoom)
private.POST("/live/admin/rooms", h.CreateRoom)
private.PUT("/live/admin/rooms/:id", h.UpdateRoom)
private.DELETE("/live/admin/rooms/:id", h.DeleteRoom)
private.PATCH("/live/admin/rooms/:id/status", h.SetRoomStatus)
private.PUT("/live/admin/rooms/sort", h.SaveRoomSort)
}
+10
View File
@@ -0,0 +1,10 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterLiveChat(public *gin.RouterGroup, h *handler.LiveChat) {
public.GET("/live/rooms/:id/messages", h.History)
}
+14
View File
@@ -0,0 +1,14 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterLiveClient(public, private *gin.RouterGroup, h *handler.LiveClient) {
public.POST("/live/client/auth/login", h.Login)
public.POST("/live/client/auth/register", h.Register)
private.GET("/live/client/me", h.Me)
private.PUT("/live/client/me", h.UpdateProfile)
private.PUT("/live/client/me/password", h.ChangePassword)
}
@@ -0,0 +1,11 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterPlatformSetting(public, private *gin.RouterGroup, h *handler.PlatformSetting) {
public.GET("/live/settings", h.Get)
private.PUT("/live/admin/settings", h.Save)
}
+14
View File
@@ -0,0 +1,14 @@
package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterRecharge(public, private *gin.RouterGroup, h *handler.Recharge) {
public.GET("/live/recharge/plans", h.Plans)
private.PUT("/live/admin/recharge/plans", h.SavePlans)
private.GET("/live/admin/orders", h.List)
private.GET("/live/admin/orders/:orderNo", h.Get)
private.POST("/live/recharge/orders", h.Create)
}
+8
View File
@@ -42,6 +42,14 @@ func (r *Routes) RegisterRoutes(public, private *gin.RouterGroup, engine *gin.En
func() { RegisterEmail(private, r.handlers.Email) },
func() { RegisterIntegrationConfig(private, r.handlers.IntegrationConfig) },
func() { RegisterPayment(private, public, r.handlers.Payment) },
func() { RegisterLive(public, private, r.handlers.Live) },
func() { RegisterLiveChat(public, r.handlers.LiveChat) },
func() { RegisterLiveClient(public, private, r.handlers.LiveClient) },
func() { RegisterGift(public, private, r.handlers.Gift) },
func() { RegisterRecharge(public, private, r.handlers.Recharge) },
func() { RegisterAsset(private, r.handlers.Asset) },
func() { RegisterPlatformSetting(public, private, r.handlers.PlatformSetting) },
func() { RegisterAnalytics(private, r.handlers.Analytics) },
}
for _, register := range registrations {
register()