diff --git a/src/Oms.Application/Dtos/System/BrandLogoOutput.cs b/src/Oms.Application/Dtos/System/BrandLogoOutput.cs
index a2478fa..6026054 100644
--- a/src/Oms.Application/Dtos/System/BrandLogoOutput.cs
+++ b/src/Oms.Application/Dtos/System/BrandLogoOutput.cs
@@ -14,4 +14,14 @@ public class BrandLogoOutput
/// 官网 Logo 可访问 URL;未配置时为空。
///
public string SiteUrl { get; set; } = string.Empty;
+
+ ///
+ /// 网站标签(favicon)可访问 URL;未配置时为空。
+ ///
+ public string FaviconUrl { get; set; } = string.Empty;
+
+ ///
+ /// 启动页 / 空态吉祥物可访问 URL;未配置时为空。
+ ///
+ public string MascotUrl { get; set; } = string.Empty;
}
diff --git a/src/Oms.Application/Dtos/System/BrandLogoUploadInput.cs b/src/Oms.Application/Dtos/System/BrandLogoUploadInput.cs
index ba54106..534076a 100644
--- a/src/Oms.Application/Dtos/System/BrandLogoUploadInput.cs
+++ b/src/Oms.Application/Dtos/System/BrandLogoUploadInput.cs
@@ -8,7 +8,7 @@ namespace Oms.Application.Dtos.System;
public class BrandLogoUploadInput
{
///
- /// 渠道:portal(系统顶栏)/ site(官网)。
+ /// 渠道:portal(系统顶栏)/ site(官网)/ favicon(网站标签)/ mascot(启动页吉祥物)。
///
public string Channel { get; set; } = string.Empty;
diff --git a/src/Oms.Application/Services/System/SystemOtherConfigService.cs b/src/Oms.Application/Services/System/SystemOtherConfigService.cs
index c24633a..d091e30 100644
--- a/src/Oms.Application/Services/System/SystemOtherConfigService.cs
+++ b/src/Oms.Application/Services/System/SystemOtherConfigService.cs
@@ -24,6 +24,8 @@ public class SystemOtherConfigService : ApplicationService
private const string PaymentQrChannelWechat = "wechat";
private const string BrandLogoChannelPortal = "portal";
private const string BrandLogoChannelSite = "site";
+ private const string BrandLogoChannelFavicon = "favicon";
+ private const string BrandLogoChannelMascot = "mascot";
private ISystemOtherConfigRepository SystemOtherConfigRepository =>
LazyServiceProvider.GetRequiredService();
@@ -197,22 +199,18 @@ public class SystemOtherConfigService : ApplicationService
}
///
- /// 获取品牌 Logo(系统顶栏 / 官网)。未配置时对应 URL 为空(前端回退本地默认图)。匿名可读,供官网使用。
+ /// 获取品牌 Logo(系统顶栏 / 官网 / 网站标签 / 启动页吉祥物)。未配置时对应 URL 为空(前端回退本地默认图)。匿名可读。
///
[AllowAnonymous]
[HttpGet("/system/other-config/brand-logo")]
public async Task GetBrandLogoAsync()
{
var entity = await SystemOtherConfigRepository.GetByConfigCodeAsync(SystemOtherConfigCodes.BrandLogo);
- return new BrandLogoOutput
- {
- PortalUrl = FileStorage.GetPublicUrl(entity?.AppKey),
- SiteUrl = FileStorage.GetPublicUrl(entity?.Remark)
- };
+ return MapBrandLogoOutput(entity);
}
///
- /// 上传并替换品牌 Logo。Channel=portal|site;返回最新可访问 URL。
+ /// 上传并替换品牌 Logo。Channel=portal|site|favicon|mascot;返回最新可访问 URL。
///
/// 入参:渠道 + 图片文件。
[HttpPost("/system/other-config/brand-logo/upload")]
@@ -220,9 +218,13 @@ public class SystemOtherConfigService : ApplicationService
public async Task UploadBrandLogoAsync([FromForm] BrandLogoUploadInput input)
{
var channel = (input.Channel ?? string.Empty).Trim().ToLowerInvariant();
- if (channel is not (BrandLogoChannelPortal or BrandLogoChannelSite))
+ if (channel is not (
+ BrandLogoChannelPortal
+ or BrandLogoChannelSite
+ or BrandLogoChannelFavicon
+ or BrandLogoChannelMascot))
{
- throw new BusinessException("渠道仅支持 portal 或 site");
+ throw new BusinessException("渠道仅支持 portal、site、favicon 或 mascot");
}
var key = await OmsFileUploadHelper.SaveBrandLogoAsync(input.File, FileStorage);
@@ -231,19 +233,34 @@ public class SystemOtherConfigService : ApplicationService
{
entity.AppKey = key;
}
- else
+ else if (channel == BrandLogoChannelSite)
{
entity.Remark = key;
}
+ else if (channel == BrandLogoChannelFavicon)
+ {
+ // BaseUrl 复用为 favicon object key(非网关地址)
+ entity.BaseUrl = key;
+ }
+ else
+ {
+ // AppSecret 复用为启动页吉祥物 object key(非密钥)
+ entity.AppSecret = key;
+ }
await SystemOtherConfigRepository.UpdateAsync(entity);
- return new BrandLogoOutput
- {
- PortalUrl = FileStorage.GetPublicUrl(entity.AppKey),
- SiteUrl = FileStorage.GetPublicUrl(entity.Remark)
- };
+ return MapBrandLogoOutput(entity);
}
+ private BrandLogoOutput MapBrandLogoOutput(SystemOtherConfig? entity) =>
+ new()
+ {
+ PortalUrl = FileStorage.GetPublicUrl(entity?.AppKey),
+ SiteUrl = FileStorage.GetPublicUrl(entity?.Remark),
+ FaviconUrl = FileStorage.GetPublicUrl(entity?.BaseUrl),
+ MascotUrl = FileStorage.GetPublicUrl(entity?.AppSecret)
+ };
+
private async Task EnsurePaymentReceiveQrConfigAsync()
{
var entity = await SystemOtherConfigRepository.GetByConfigCodeAsync(SystemOtherConfigCodes.PaymentReceiveQr);
@@ -291,8 +308,7 @@ public class SystemOtherConfigService : ApplicationService
deleted.ConfigName = "品牌 Logo";
deleted.Enabled = true;
deleted.TimeoutSeconds = 30;
- deleted.BaseUrl = null;
- deleted.AppSecret = null;
+ // 保留 AppKey/Remark/BaseUrl/AppSecret 中的 Logo object key,避免恢复时丢图
await SystemOtherConfigRepository.UpdateAsync(deleted);
return deleted;
}
diff --git a/src/Oms.Domain/SystemAggregate/Consts/SystemOtherConfigCodes.cs b/src/Oms.Domain/SystemAggregate/Consts/SystemOtherConfigCodes.cs
index 8116eae..46fc49f 100644
--- a/src/Oms.Domain/SystemAggregate/Consts/SystemOtherConfigCodes.cs
+++ b/src/Oms.Domain/SystemAggregate/Consts/SystemOtherConfigCodes.cs
@@ -66,7 +66,7 @@ public static class SystemOtherConfigCodes
public const string PaymentReceiveQr = "payment_receive_qr";
///
- /// 品牌 Logo(AppKey=系统顶栏 Logo object key,Remark=官网 Logo object key)。
+ /// 品牌 Logo(AppKey=系统顶栏,Remark=官网,BaseUrl=favicon,AppSecret=启动页吉祥物;均为 object key)。
///
public const string BrandLogo = "brand_logo";
}