Commit c50c9158 authored by 吴春's avatar 吴春

提交小程序评价标签以及规格日期

parent 649b18d4
......@@ -204,6 +204,6 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 评论标签Id
/// </summary>
public int LabelId { get; set; }
public string LabelIds { get; set; }
}
}
......@@ -7,5 +7,9 @@ namespace Mall.Model.Extend.Product
/// </summary>
public class RB_Comment_Label_Extend: RB_Comment_Label
{
/// <summary>
/// 评价数
/// </summary>
public int CommentNum { get; set; }
}
}
......@@ -38,16 +38,25 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int CommentNum { get; set; }
/// <summary>
/// 评论标签ids 2024-02-18 add by:W
/// </summary>
public List<string> CommentLabelList { get; set; }
/// <summary>
/// 评论标签id 2024-02-18 add by:W
/// </summary>
public int CommentLabelId { get; set; }
/// <summary>
/// 评论总分
/// </summary>
public decimal TotalScore { get; set; }
#region 司导信息
/// <summary>
/// 导游名称
/// </summary>
......
......@@ -29,5 +29,15 @@ namespace Mall.Model.Extend.Product
/// 查询排序
/// </summary>
public int? SortNum { get; set; }
/// <summary>
/// 是否日期格式 2024-02-19 add by:W
/// </summary>
public int IsDateFormat { get; set; }
/// <summary>
/// 日期信息 2024-02-19 add by:W
/// </summary>
public DateTime? DateTimeInfo { get; set; }
}
}
This diff is collapsed.
......@@ -1611,6 +1611,7 @@ namespace Mall.Module.Product
decimal MaxSellMoney = model.SellingPrice ?? 0;
model.SpecificationList = new List<RB_Goods_Specification_Extend>();
model.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
List<RB_Goods_SpecificationPrice_Extend> specificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (model.IsCustomSpecification == 1)
{
model.SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
......@@ -2000,7 +2001,7 @@ namespace Mall.Module.Product
else
{
//判断是否开启和平返佣
List<WhereHelper> wheres = new List<WhereHelper>()
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -2026,7 +2027,7 @@ namespace Mall.Module.Product
FiledValue=MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
};
if (distributor_HPCommissionRepository.Exists(wheres))
{
//获取和平分销返佣
......@@ -2144,6 +2145,7 @@ namespace Mall.Module.Product
{
if (model.SpecificationPriceList.Any() && model.SpecificationList.Any())
{
List<RB_Goods_Specification_Extend> SpecificationListToPrice = new List<RB_Goods_Specification_Extend>();
List<RB_Goods_SpecificationValue_Extend> SpecificationValueListToPrice = new List<RB_Goods_SpecificationValue_Extend>();
bool IsHaveSellingPriceZero = false;
......@@ -2175,6 +2177,7 @@ namespace Mall.Module.Product
for (int i = 0; i < ssarr.Length; i++)
{
var smodel = model.SpecificationList[i];
if (IsHaveSellingPriceZero && !SpecificationListToPrice.Where(x => x.Id == smodel.Id).Any())
{
SpecificationListToPrice.Add(smodel);
......@@ -2184,6 +2187,21 @@ namespace Mall.Module.Product
{
SpecificationValueListToPrice.Add(svmodel);
}
//2024-02-19 add by:W 日期格式的话过滤掉小于当前日期的价格
if (smodel.IsDateFormat == 1 && !string.IsNullOrWhiteSpace(svmodel?.Name ?? ""))
{
try
{
DateTime startTime = Convert.ToDateTime(svmodel?.Name ?? "");
if (startTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")))
{
specificationPriceList.Add(item);
}
}
catch (Exception ex)
{
}
}
attr_list.Add(new
{
attr_group_name = smodel.Name,
......@@ -2401,7 +2419,16 @@ namespace Mall.Module.Product
{
if (model.IsCustomSpecification == 1 && model.SpecificationPriceList != null && model.SpecificationPriceList.Count > 0)
{
var tempList = model.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
List<RB_Goods_SpecificationPrice_Extend> tempList = new List<RB_Goods_SpecificationPrice_Extend>();
if (model?.SpecificationList?.Where(x => x.IsDateFormat == 1)?.Count() > 0)//有日期格式的规格
{
tempList = specificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
}
else
{
tempList = model.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
}
if (tempList != null && tempList.Count > 0)
{
price_member_min = price_min = tempList?.Min(x => x.SellingPrice ?? 0) ?? 0;
......@@ -2443,7 +2470,7 @@ namespace Mall.Module.Product
GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId);
#endregion
#region 返回参数
......@@ -2485,7 +2512,7 @@ namespace Mall.Module.Product
ImagePath = ""
}
};
model.SpecificationList = new List<RB_Goods_Specification_Extend>
model.SpecificationList = new List<RB_Goods_Specification_Extend>
{
new RB_Goods_Specification_Extend()
{
......@@ -2585,7 +2612,7 @@ namespace Mall.Module.Product
attr_group_name = x.Name,
//购买次数(进阶小课堂使用)
service_time = model.ServiceTime,
attr_list =attrList,
attr_list = attrList,
//dateList,
});
}
......@@ -2623,7 +2650,7 @@ namespace Mall.Module.Product
// pic_url = z.ImagePath
// })
//}),
attr_groups= groupsList,
attr_groups = groupsList,
attr = priceList,
goodsRelevanceList = goodsRelevanceList?.Select(qitem => new
{
......@@ -2681,7 +2708,7 @@ namespace Mall.Module.Product
video_url = model?.VideoAddress ?? "",
level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价
is_sales = model.GoodsStatus == 1 && model.InventoryNum > 0 ? 1 : 2,//是否可购买
//goods_num = model.InventoryNum,
goods_no = model.GoodsNumbers,
goods_weight = model.GoodsWeight,
......@@ -8194,6 +8221,33 @@ namespace Mall.Module.Product
foreach (var item in model.SpecificationList)
{
item.SpecificationValueList = svlist.Where(x => x.SpecificationId == item.Id).ToList();
#region 注释过期日期对应的规格 2024-02-19 add by:W
//var tempSpecificationValueList = svlist.Where(x => x.SpecificationId == item.Id).ToList();
//if (item.IsDateFormat == 1)
//{
// item.SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>();
// DateTime nowDay = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
// foreach (var itemSpecificationValue in tempSpecificationValueList)
// {
// try
// {
// if (!string.IsNullOrWhiteSpace(itemSpecificationValue?.Name ?? "")&&Convert.ToDateTime(itemSpecificationValue?.Name ?? "") >= nowDay)
// {
// item.SpecificationValueList.Add(itemSpecificationValue);
// }
// }
// catch (Exception ex)
// {
// }
// }
//}
//else
//{
// item.SpecificationValueList = tempSpecificationValueList;
//}
#endregion
}
}
int SortNum = 1;
......
......@@ -39,6 +39,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Comment_Label_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Comment_Label_Extend.Name)} like '%{query.Name}%'");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Comment_Label_Extend.Id));
return GetPage<RB_Comment_Label_Extend>(pageIndex, pageSize, out totalCount, builder.ToString()).ToList();
......@@ -69,6 +73,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Comment_Label_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Comment_Label_Extend.Name)} like '%{query.Name}%'");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Comment_Label_Extend.Id));
return Get<RB_Comment_Label_Extend>(builder.ToString()).ToList();
......
......@@ -88,7 +88,10 @@ where {where} order by c.Id desc";
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={dmodel.GoodsId}";
}
if (dmodel.CommentLabelId > 0)
{
where += $@" AND FIND_IN_SET({dmodel.CommentLabelId},c.{nameof(RB_Goods_Comment.LabelIds)})";
}
if (dmodel.UserId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.UserId)}={dmodel.UserId}";
......@@ -109,11 +112,71 @@ where {where} order by c.Id desc";
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
if (dmodel.CommentGrade.HasValue && dmodel.CommentGrade.Value > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.CommentGrade)}={(int)dmodel.CommentGrade}";
}
string sql = $@"SELECT c.* FROM RB_Goods_Comment c where {where} order by c.Is_Top asc,c.Id desc";
return GetPage<RB_Goods_Comment_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_Comment_Extend> GetAppletCommentList(RB_Goods_Comment_Extend dmodel)
{
string where = $" 1=1 and c.{nameof(RB_Goods_Comment.Status)}=0 ";
if (dmodel.TenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Id)}={dmodel.Id}";
}
if (dmodel.GoodsId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={dmodel.GoodsId}";
}
if (dmodel.UserId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.UserId)}={dmodel.UserId}";
}
if (dmodel.PlatformSource > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.PlatformSource)}={(int)dmodel.PlatformSource}";
}
if (dmodel.Is_Show > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Is_Show)}={dmodel.Is_Show}";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and c.{nameof(RB_Goods_Comment.UserName)} like '%{dmodel.UserName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content))
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"SELECT c.* FROM RB_Goods_Comment c where {where} order by c.Is_Top asc,c.Id desc";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
/// <summary>
/// 获取评论数量统计
/// </summary>
......
......@@ -522,7 +522,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
if (userInfo.TenantId == 29)
{
if (string.IsNullOrWhiteSpace(demodel?.CustomFormInfo??""))
if (string.IsNullOrWhiteSpace(demodel?.CustomFormInfo ?? ""))
{
return ApiResult.ParamIsNull("请填写旅客信息");
}
......@@ -1385,6 +1385,43 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取商品评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetAppletGoodsCommentLabelList()
{
var parms = RequestParm;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.Is_Show = 1;
var list = orderModule.GetAppletCommentList(demodel);
//获取标签信息
var commentLabelList = orderModule.GetCommentLabelListModule(new RB_Comment_Label_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
foreach (var itemLabel in commentLabelList)
{
itemLabel.CommentNum = 0;
foreach (var item in list)
{
if (item.CommentLabelList != null && item.CommentLabelList.Any(x => x == itemLabel.Id.ToString()))
{
itemLabel.CommentNum += 1;
}
}
}
var result = commentLabelList.Where(x => x.CommentNum > 0).Select(x => new { x.CommentNum, x.Name, x.Id });
return ApiResult.Success("", result);
}
/// <summary>
/// 获取商品评论统计
/// </summary>
......
......@@ -4818,16 +4818,13 @@ namespace Mall.WebApi.Controllers.MallBase
Name = parm.GetStringValue("Name"),
Status = 0,
TenantId = userInfo.TenantId,
MallBaseId = userInfo.MallBaseId,
MallBaseId = base.RequestParm.MallBaseId,
};
if (extModel.Id > 0)
{
extModel.UpdateDate = DateTime.Now;
}
else
if (extModel.Id == 0)
{
extModel.CreateDate = DateTime.Now;
}
extModel.UpdateDate = DateTime.Now;
bool flag = orderModule.SetCommentLabelModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......@@ -4869,16 +4866,18 @@ namespace Mall.WebApi.Controllers.MallBase
var parm = JObject.Parse(base.RequestParm.msg.ToString());
ResultPageModel pageModel = new ResultPageModel()
{
pageIndex=parm.GetInt("pageIndex"),
pageSize=parm.GetInt("pageSize"),
pageIndex = parm.GetInt("pageIndex"),
pageSize = parm.GetInt("pageSize"),
};
var query = new RB_Comment_Label_Extend()
{
Name=parm.GetStringValue("Name"),
Name = parm.GetStringValue("Name"),
TenantId = base.RequestParm.TenantId,
MallBaseId = base.RequestParm.MallBaseId,
};
var dataList = orderModule.GetCommentLabelPageModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = dataList;
pageModel.pageData = dataList.Select(x => new { x.Id, x.MallBaseId, x.TenantId, x.Name, UpdateDate = x.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") });
return ApiResult.Success(data: pageModel);
}
......@@ -4893,8 +4892,10 @@ namespace Mall.WebApi.Controllers.MallBase
var query = new RB_Comment_Label_Extend()
{
Name = parm.GetStringValue("Name"),
// TenantId = base.RequestParm.TenantId,
MallBaseId = base.RequestParm.MallBaseId,
};
var dataList = orderModule.GetCommentLabelListModule( query);
var dataList = orderModule.GetCommentLabelListModule(query);
return ApiResult.Success(data: dataList);
}
#endregion
......
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