feat: 接入旧站管理端并完整迁移后台能力

This commit is contained in:
yml
2026-11-12 22:03:01 +08:00
parent e5f923706b
commit a4441bba9a
509 changed files with 140714 additions and 1068 deletions
@@ -4,6 +4,7 @@ import (
"net/http"
"strconv"
"hfb_jysh/backend/internal/middleware"
filemodule "hfb_jysh/backend/internal/modules/file"
"hfb_jysh/backend/internal/sitecode"
"hfb_jysh/backend/pkg/response"
@@ -12,7 +13,9 @@ import (
)
func (h *Handler) ListPublic(c *gin.Context) {
items, err := h.service.ListPublic(c.Request.Context(), parsePublicListQuery(c))
query := parsePublicListQuery(c)
query.ViewerUserID = optionalCurrentUserID(c)
items, err := h.service.ListPublic(c.Request.Context(), query)
if err != nil {
writeListingError(c, err)
return
@@ -26,7 +29,7 @@ func (h *Handler) FindPublic(c *gin.Context) {
return
}
siteCode := sitecode.FromRequest(c)
item, err := h.service.FindPublic(c.Request.Context(), id, siteCode)
item, err := h.service.FindPublic(c.Request.Context(), id, siteCode, optionalCurrentUserID(c))
if err != nil {
writeListingError(c, err)
return
@@ -34,6 +37,15 @@ func (h *Handler) FindPublic(c *gin.Context) {
response.OK(c, item)
}
func optionalCurrentUserID(c *gin.Context) uint64 {
value, ok := c.Get(middleware.ContextUserID)
if !ok {
return 0
}
userID, _ := value.(uint64)
return userID
}
func (h *Handler) Cover(c *gin.Context) {
id, ok := parseID(c)
if !ok {