312
This commit is contained in:
parent
d55ac149d4
commit
1a799caadc
|
|
@ -72,7 +72,7 @@ public class InvitationService : IInvitationService
|
|||
|
||||
// 获取分享配置
|
||||
var shareTitle = await GetShareTitleAsync();
|
||||
var shareImage = string.Empty; // 海报图片需要单独生成,这里暂时返回空
|
||||
var shareImage = await GetShareImageAsync();
|
||||
|
||||
return new InvitationInfoResponse
|
||||
{
|
||||
|
|
@ -255,5 +255,35 @@ public class InvitationService : IInvitationService
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分享海报图片配置
|
||||
/// </summary>
|
||||
/// <returns>分享海报图片URL</returns>
|
||||
private async Task<string> GetShareImageAsync()
|
||||
{
|
||||
var config = await _dbContext.Configs
|
||||
.FirstOrDefaultAsync(c => c.ConfigKey == "base");
|
||||
|
||||
if (config?.ConfigValue == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var jsonDoc = JsonSerializer.Deserialize<JsonElement>(config.ConfigValue);
|
||||
if (jsonDoc.TryGetProperty("share_image", out var shareImage))
|
||||
{
|
||||
return shareImage.GetString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "解析分享海报图片配置失败");
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user