|
@@ -321,7 +321,7 @@ namespace GxPress.Repository.Implement
|
|
|
public async Task<bool> UpdateCommentAsync(CommentUpdateRequest request)
|
|
|
{
|
|
|
//判断类容是否为空
|
|
|
- if (string.IsNullOrWhiteSpace(request.Content))
|
|
|
+ if (string.IsNullOrWhiteSpace(request.Content) || string.IsNullOrWhiteSpace(request.JsonContent) || string.IsNullOrWhiteSpace(request.HtmlContent))
|
|
|
throw new Common.Exceptions.BusinessException("评论不能为空!");
|
|
|
//查询评论
|
|
|
var comment = await _repository.GetAsync(request.CommentId);
|
|
@@ -330,6 +330,12 @@ namespace GxPress.Repository.Implement
|
|
|
if (comment.UserId != request.UserId)
|
|
|
throw new Common.Exceptions.BusinessException("该评论不属于该用户!");
|
|
|
//修改
|
|
|
+ if (!string.IsNullOrWhiteSpace(request.Content))
|
|
|
+ comment.Content = request.Content;
|
|
|
+ if (!string.IsNullOrWhiteSpace(request.HtmlContent))
|
|
|
+ comment.HtmlContent = request.HtmlContent;
|
|
|
+ if (!string.IsNullOrWhiteSpace(request.JsonContent))
|
|
|
+ comment.JsonContent = request.JsonContent;
|
|
|
comment.Content = request.Content;
|
|
|
if (request.Score > 0)
|
|
|
comment.Score = request.Score;
|