feat: 品牌 Logo 与充值收款码支持按渠道清除 #28
@ -198,6 +198,37 @@ public class SystemOtherConfigService : ApplicationService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除指定渠道充值收款码。Channel=alipay|wechat;清除后对应 URL 为空。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channel">渠道:alipay / wechat。</param>
|
||||||
|
[HttpPost("/system/other-config/payment-qr/clear")]
|
||||||
|
public async Task<PaymentReceiveQrOutput> 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)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取品牌 Logo(系统顶栏 / 官网 / 网站标签 / 启动页吉祥物)。未配置时对应 URL 为空(前端回退本地默认图)。匿名可读。
|
/// 获取品牌 Logo(系统顶栏 / 官网 / 网站标签 / 启动页吉祥物)。未配置时对应 URL 为空(前端回退本地默认图)。匿名可读。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -252,6 +283,45 @@ public class SystemOtherConfigService : ApplicationService
|
|||||||
return MapBrandLogoOutput(entity);
|
return MapBrandLogoOutput(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除指定渠道的品牌 Logo。Channel=portal|site|favicon|mascot;清除后前端显示文字 LOGO。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channel">渠道:portal / site / favicon / mascot。</param>
|
||||||
|
[HttpPost("/system/other-config/brand-logo/clear")]
|
||||||
|
public async Task<BrandLogoOutput> 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) =>
|
private BrandLogoOutput MapBrandLogoOutput(SystemOtherConfig? entity) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user