feat(distribution): 分站品牌装修可配置首页入口并上传图片
分站可单独配置回收、合作反馈和客服二维码,未配置时继承主站;Logo、图标和轮播支持直接上传。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -101,7 +101,8 @@ func (h *Handler) writeObject(c *gin.Context, publicOnly bool) {
|
||||
!strings.HasPrefix(key, "mohong/") &&
|
||||
!strings.HasPrefix(key, "crash/") &&
|
||||
!strings.HasPrefix(key, "aw-recycle/") &&
|
||||
!strings.HasPrefix(key, "cooperation-feedback/") {
|
||||
!strings.HasPrefix(key, "cooperation-feedback/") &&
|
||||
!strings.HasPrefix(key, "support-qrcode/") {
|
||||
response.Error(c, http.StatusNotFound, "not_found", "文件不存在或暂不可访问")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func normalizeContentType(contentType string, data []byte) string {
|
||||
|
||||
func fileURLForScene(scene string, key string) string {
|
||||
fileURL := "/api/files/object?key=" + url.QueryEscape(key)
|
||||
if scene == "home-banner" || scene == "avatar" || scene == "announcement" || scene == "mohong" || scene == "crash" || scene == "aw-recycle" || scene == "cooperation-feedback" {
|
||||
if scene == "home-banner" || scene == "avatar" || scene == "announcement" || scene == "mohong" || scene == "crash" || scene == "aw-recycle" || scene == "cooperation-feedback" || scene == "support-qrcode" {
|
||||
fileURL = "/api/public/files/object?key=" + url.QueryEscape(key)
|
||||
}
|
||||
return fileURL
|
||||
@@ -118,7 +118,7 @@ func fileURLForScene(scene string, key string) string {
|
||||
func normalizeScene(scene string) string {
|
||||
scene = strings.TrimSpace(strings.ToLower(scene))
|
||||
switch scene {
|
||||
case "listing", "handoff", "dispute", "realname", "avatar", "home-banner", "chat", "payment-cert", "announcement", "qrcode", "mohong", "crash", "aw-recycle", "cooperation-feedback", "manual-disbursement", "operating-expense":
|
||||
case "listing", "handoff", "dispute", "realname", "avatar", "home-banner", "chat", "payment-cert", "announcement", "qrcode", "support-qrcode", "mohong", "crash", "aw-recycle", "cooperation-feedback", "manual-disbursement", "operating-expense":
|
||||
return scene
|
||||
case "listing_screenshot", "listing-screenshot":
|
||||
return "listing"
|
||||
|
||||
@@ -77,6 +77,16 @@ func TestCooperationFeedbackSceneUsesPublicFileURL(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSupportQrcodeSceneUsesPublicFileURL(t *testing.T) {
|
||||
if got := normalizeScene("support-qrcode"); got != "support-qrcode" {
|
||||
t.Fatalf("normalize support-qrcode scene = %q", got)
|
||||
}
|
||||
got := fileURLForScene("support-qrcode", "support-qrcode/2026/09/25/example.png")
|
||||
if !strings.HasPrefix(got, "/api/public/files/object?") {
|
||||
t.Fatalf("support-qrcode file url = %q, want public file endpoint", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeSceneListingScreenshotAndOperatingExpense(t *testing.T) {
|
||||
if got := normalizeScene("listing_screenshot"); got != "listing" {
|
||||
t.Fatalf("normalize listing_screenshot scene = %q, want listing", got)
|
||||
|
||||
Reference in New Issue
Block a user