style: 修复消息样式

This commit is contained in:
chenchun
2024-08-07 11:12:01 +08:00
parent bb6e9b9e3f
commit 4097244d5b
5 changed files with 70 additions and 68 deletions

View File

@@ -9,7 +9,6 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts
/// <summary>
/// 常量定义
/// </summary>
public class DiscussConst
{
public const string No_Exist = "传入的主题id不存在";
@@ -18,32 +17,20 @@ namespace Yi.Framework.Bbs.Domain.Shared.Consts
public const string AgreeNotice = """
<div>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍗 [{0}] [{1}] </h3>
<p class="link" style="color: #555;font-size: 16px;">
<a href="/article/{2}" target="_blank" style="color: #007BFF;text-decoration: none;">https://ccnetcore.com/article/{2}</a>
</p>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍗 [<a href="/article/{2}" target="_blank" style="color: #007BFF;text-decoration: none;">{0}</a>] [{1}] </h3>
</div>
""";
public const string CommentNotice = """
<div>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍖 [{0}] [{1}] !</h3>
<p class="link" style="color: #555;font-size: 16px;">
[{2}]
<a href="/article/{3}" target="_blank" style="color: #007BFF;text-decoration: none;">https://ccnetcore.com/article/{3}</a>
</p>
</div>
""";
public const string CommentNoticeToReply= """
<div>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍖 [{0}] [{1}] !</h3>
<p class="link" style="color: #555;font-size: 16px;">
[{2}]
<a href="/article/{3}" target="_blank" style="color: #007BFF;text-decoration: none;">https://ccnetcore.com/article/{3}</a>
</p>
</div>
""";
<div>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍖 [<a href="/article/{3}" target="_blank" style="color: #007BFF;text-decoration: none;">{0}</a>] [{1}] !</h3>
</div>
""";
public const string CommentNoticeToReply = """
<div>
<h3 class="title" style="color: #333; font-size: 18px; margin: 0 0 10px;">🍖 [<a href="/article/{3}" target="_blank" style="color: #007BFF;text-decoration: none;">{0}</a>] [{1}] !</h3>
</div>
""";
}
}
}

View File

@@ -54,9 +54,15 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content;
//通知主题作者,有人评论
await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussUserId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false);
//通知回复者,有人评论
await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNoticeToReply, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false);
//如果为空,表示根路径,没有回复者
if (commentEntity.ParentId != Guid.Empty)
{
//通知回复者,有人评论
await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNoticeToReply, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false);
}
}
}
}

View File

@@ -37,6 +37,12 @@ namespace Yi.Framework.Rbac.Application.Services
{
var path = await GetReturnPathAsync(code, isThumbnail);
if (!File.Exists(path))
{
throw new UserFriendlyException("文件不存在",code:"404");
}
var steam = await File.ReadAllBytesAsync(path);
//考虑从路径中获取