Commit abf6fc18 authored by liudong1993's avatar liudong1993

商品评论

parent 4f5d8843
......@@ -14,6 +14,10 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderDetail_Extend : RB_Goods_OrderDetail
{
/// <summary>
/// 用户id
/// </summary>
public int? UserId { get; set; }
/// <summary>
/// 订单财务单据列表
/// </summary>
......
......@@ -9689,6 +9689,27 @@ namespace Mall.Module.Product
return list;
}
/// <summary>
/// 获取待评论商品列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetAppletGoodsWaitCommentPageList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend demodel)
{
var list = goods_OrderDetailRepository.GetAppletGoodsWaitCommentPageList(pageIndex, pageSize, out count, demodel);
foreach (var item in list) {
item.SpecificationList = new List<string>();
if (!string.IsNullOrEmpty(item.Specification) && item.Specification != "[]")
{
item.SpecificationList = JsonConvert.DeserializeObject<List<string>>(item.Specification);
}
}
return list;
}
/// <summary>
/// 获取订单评价列表
/// </summary>
......
......@@ -526,5 +526,66 @@ INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where {where} order by o.CreateDate desc";
return GetPage<RB_Goods_OrderDetail_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取待评论商品列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetAppletGoodsWaitCommentPageList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.MallBaseId)}={dmodel.MallBaseId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderDetailIds))
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.Id)} in({dmodel.OrderDetailIds})";
}
if (dmodel.OrderId > 0)
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderType > 0)
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.OrderType)}={(int)dmodel.OrderType}";
}
if (dmodel.IsComment > 0)
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.IsComment)}={(int)dmodel.IsComment}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(dmodel.ProductCode))
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and a.{nameof(RB_Goods_OrderDetail.OrderId)} in({dmodel.OrderIds})";
}
if (!string.IsNullOrEmpty(dmodel.OrderNo))
{
where += $@" and o.{nameof(RB_Goods_Order.OrderNo)} ='{dmodel.OrderNo}'";
}
if (dmodel.UserId > 0) {
where += $@" and o.{nameof(RB_Goods_Order.UserId)} ={dmodel.UserId}";
}
string sql = $@"SELECT a.* FROM rb_goods_orderdetail as a
left join rb_goods_order o on a.OrderId = o.OrderId
where {where} order by a.Id desc";
return GetPage<RB_Goods_OrderDetail_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
}
}
......@@ -842,6 +842,35 @@ namespace Mall.WebApi.Controllers.MallBase
#region 订单评价
/// <summary>
/// 获取商品待评论列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsWaitCommentPageList() {
var parms = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_OrderDetail_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_OrderDetail_Extend>(parms.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
var list = orderModule.GetAppletGoodsWaitCommentPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
OrderDetailId = x.Id,
x.GoodsId,
x.GoodsName,
x.CoverImage,
x.SpecificationList,
x.IsComment,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取商品评论分页列表
/// </summary>
......
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