Commit b0b669f9 authored by liudong1993's avatar liudong1993

评论调整

parent 575b41e6
......@@ -64,6 +64,10 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 评分 1-5分
/// </summary>
public int? CommentScore { get; set; }
/// <summary>
/// 评论内容
/// </summary>
public string Content
......
......@@ -901,6 +901,7 @@ namespace Mall.WebApi.Controllers.MallBase
UserPhotoPath = x.UserPhotoPath ?? "",
x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(),
x.CommentScore,
x.CommentImgList,
x.Content,
x.Reply,
......@@ -948,15 +949,21 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请输入评价内容");
}
if (!demodel.CommentGrade.HasValue)
{
return ApiResult.ParamIsNull("请选择评分");
}
demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.CommentGrade ??= Common.Enum.Goods.GoodsCommentTypeEnum.Praise;
demodel.CommentScore ??= 5;
if (demodel.CommentScore == 3 || demodel.CommentScore == 2)
{
demodel.CommentGrade = Common.Enum.Goods.GoodsCommentTypeEnum.Medium;
}
else if (demodel.CommentScore == 1) {
demodel.CommentGrade = Common.Enum.Goods.GoodsCommentTypeEnum.Negative;
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment