Commit 69e2af4f authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq-ld

parents 04e62a54 b0b669f9
...@@ -64,6 +64,10 @@ namespace Mall.Model.Entity.Product ...@@ -64,6 +64,10 @@ namespace Mall.Model.Entity.Product
set; set;
} }
/// <summary> /// <summary>
/// 评分 1-5分
/// </summary>
public int? CommentScore { get; set; }
/// <summary>
/// 评论内容 /// 评论内容
/// </summary> /// </summary>
public string Content public string Content
......
...@@ -901,6 +901,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -901,6 +901,7 @@ namespace Mall.WebApi.Controllers.MallBase
UserPhotoPath = x.UserPhotoPath ?? "", UserPhotoPath = x.UserPhotoPath ?? "",
x.CommentGrade, x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(), CommentGradeName = x.CommentGrade.GetEnumName(),
x.CommentScore,
x.CommentImgList, x.CommentImgList,
x.Content, x.Content,
x.Reply, x.Reply,
...@@ -948,15 +949,21 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -948,15 +949,21 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请输入评价内容"); return ApiResult.ParamIsNull("请输入评价内容");
} }
if (!demodel.CommentGrade.HasValue)
{
return ApiResult.ParamIsNull("请选择评分");
}
demodel.CommentImage = ""; demodel.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any()) if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{ {
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList); 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.UserPhoto ??= 0;
demodel.Is_Top ??= 2; demodel.Is_Top ??= 2;
demodel.Is_Show ??= 1; 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