diff --git a/src/Oms.Application/Services/System/SystemOtherConfigService.cs b/src/Oms.Application/Services/System/SystemOtherConfigService.cs index d091e30..036b02b 100644 --- a/src/Oms.Application/Services/System/SystemOtherConfigService.cs +++ b/src/Oms.Application/Services/System/SystemOtherConfigService.cs @@ -198,6 +198,37 @@ public class SystemOtherConfigService : ApplicationService }; } + /// + /// 清除指定渠道充值收款码。Channel=alipay|wechat;清除后对应 URL 为空。 + /// + /// 渠道:alipay / wechat。 + [HttpPost("/system/other-config/payment-qr/clear")] + public async Task ClearPaymentReceiveQrAsync([FromQuery] string channel) + { + var normalized = (channel ?? string.Empty).Trim().ToLowerInvariant(); + if (normalized is not (PaymentQrChannelAlipay or PaymentQrChannelWechat)) + { + throw new BusinessException("渠道仅支持 alipay 或 wechat"); + } + + var entity = await EnsurePaymentReceiveQrConfigAsync(); + if (normalized == PaymentQrChannelAlipay) + { + entity.AppKey = null; + } + else + { + entity.Remark = null; + } + + await SystemOtherConfigRepository.UpdateAsync(entity); + return new PaymentReceiveQrOutput + { + AlipayUrl = FileStorage.GetPublicUrl(entity.AppKey), + WechatUrl = FileStorage.GetPublicUrl(entity.Remark) + }; + } + /// /// 获取品牌 Logo(系统顶栏 / 官网 / 网站标签 / 启动页吉祥物)。未配置时对应 URL 为空(前端回退本地默认图)。匿名可读。 /// @@ -252,6 +283,45 @@ public class SystemOtherConfigService : ApplicationService return MapBrandLogoOutput(entity); } + /// + /// 清除指定渠道的品牌 Logo。Channel=portal|site|favicon|mascot;清除后前端显示文字 LOGO。 + /// + /// 渠道:portal / site / favicon / mascot。 + [HttpPost("/system/other-config/brand-logo/clear")] + public async Task ClearBrandLogoAsync([FromQuery] string channel) + { + var normalized = (channel ?? string.Empty).Trim().ToLowerInvariant(); + if (normalized is not ( + BrandLogoChannelPortal + or BrandLogoChannelSite + or BrandLogoChannelFavicon + or BrandLogoChannelMascot)) + { + throw new BusinessException("渠道仅支持 portal、site、favicon 或 mascot"); + } + + var entity = await EnsureBrandLogoConfigAsync(); + if (normalized == BrandLogoChannelPortal) + { + entity.AppKey = null; + } + else if (normalized == BrandLogoChannelSite) + { + entity.Remark = null; + } + else if (normalized == BrandLogoChannelFavicon) + { + entity.BaseUrl = null; + } + else + { + entity.AppSecret = null; + } + + await SystemOtherConfigRepository.UpdateAsync(entity); + return MapBrandLogoOutput(entity); + } + private BrandLogoOutput MapBrandLogoOutput(SystemOtherConfig? entity) => new() {