Commit b75cd44b authored by 黄奎's avatar 黄奎

新增评论标签表

parent 86e5dac1
......@@ -200,5 +200,10 @@ namespace Mall.Model.Entity.Product
/// 门店id
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// 评论标签Id
/// </summary>
public int LabelId { get; set; }
}
}
using VT.FW.DB;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.Product
{
......
......@@ -23,4 +23,17 @@ namespace Mall.Model.Extend.Product
/// </summary>
public List<RB_Goods_SpecificationValue_Extend> SpecificationValueList { get; set; }
}
public class DateItem
{
/// <summary>
/// 年份
/// </summary>
public int YearStr { get; set; }
public string MonthStr { get; set; }
public string DayStr { get; set; }
}
}
......@@ -25,6 +25,7 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VT.FW.DB;
......@@ -402,6 +403,11 @@ namespace Mall.Module.Product
private readonly Repository.TradePavilion.RB_Custom_FormRepository custom_FormRepository = new Repository.TradePavilion.RB_Custom_FormRepository();
/// <summary>
/// 评论标签仓储层对象
/// </summary>
private readonly RB_Comment_LabelRepository comment_LabelRepository = new RB_Comment_LabelRepository();
#region 购物车
/// <summary>
......@@ -9266,5 +9272,87 @@ namespace Mall.Module.Product
}
return list;
}
#region 评论标签管理
/// <summary>
/// 获取评论标签分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="totalCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Comment_Label_Extend> GetCommentLabelPageModule(int pageIndex, int pageSize, out long totalCount, RB_Comment_Label_Extend query)
{
var list = comment_LabelRepository.GetCommentLabelPageRepository(pageIndex, pageSize, out totalCount, query);
return list;
}
/// <summary>
/// 获取评论标签列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Comment_Label_Extend> GetCommentLabelListModule(RB_Comment_Label_Extend query)
{
var list = comment_LabelRepository.GetCommentLabelListRepository(query);
return list;
}
/// <summary>
/// 新增修改评论标签
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCommentLabelModule(RB_Comment_Label_Extend model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Comment_Label_Extend.Name),model.Name },
{nameof(RB_Comment_Label_Extend.UpdateDate),model.UpdateDate },
};
flag = comment_LabelRepository.Update(fileds, new WhereHelper(nameof(RB_Comment_Label_Extend.Id), model.Id));
}
else
{
var newId = comment_LabelRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取频率标签
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Comment_Label_Extend GetCommentLabelModule(int Id)
{
var extModel = comment_LabelRepository.GetEntity<RB_Comment_Label_Extend>(Id);
return extModel;
}
/// <summary>
/// 根据编号删除评论标签
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveCommentLabelModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Comment_Label_Extend.Status),1 },
{nameof(RB_Comment_Label_Extend.UpdateDate),DateTime.Now },
};
var flag = comment_LabelRepository.Update(fileds, new WhereHelper(nameof(RB_Comment_Label_Extend.Id), Id));
return flag;
}
#endregion
}
}
......@@ -8108,16 +8108,21 @@ namespace Mall.Module.Product
if (demodel.OrderDetailId > 0)
{
dmodel = goods_OrderDetailRepository.GetEntity(demodel.OrderDetailId);
if (dmodel == null) { return false; }
if (dmodel == null)
{
return false;
}
OrderId = dmodel.OrderId ?? 0;
if (dmodel.IsComment == 1) { return false; }
if (dmodel.IsComment == 1)
{
return false;
}
}
bool flag = goods_CommentRepository.Insert(demodel) > 0;
if (flag)
{
if (demodel.OrderDetailId > 0)
{
//if (dmodel.CommentGiveIntegral > 0 && demodel.UserId > 0)//评论返积分大于0,赠送积分
//{
// Model.Entity.User.RB_Member_Integral memberIntegralModel = new Model.Entity.User.RB_Member_Integral
......@@ -8136,13 +8141,15 @@ namespace Mall.Module.Product
// member_IntegralRepository.Insert(memberIntegralModel);
//}
//更新订单商品为已评价
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Goods_OrderDetail.IsComment),1}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods_OrderDetail.Id),
FiledValue=demodel.OrderDetailId,
OperatorEnum=OperatorEnum.Equal
......@@ -8163,10 +8170,13 @@ namespace Mall.Module.Product
score = Math.Round(Convert.ToDecimal(gcsModel.CommentScore ?? 0) / gcsModel.CommentNum, 2, MidpointRounding.AwayFromZero);
}
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods.CourseScore),score}
{
nameof(RB_Goods.CourseScore),score}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres1 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods.Id),
FiledValue=demodel.GoodsId,
OperatorEnum=OperatorEnum.Equal
......@@ -8183,11 +8193,14 @@ namespace Mall.Module.Product
if (!dlist.Any())
{
//更新订单为已完成
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
Dictionary<string, object> keyValues1 = new Dictionary<string, object>()
{
{ nameof(RB_Goods_Order.OrderStatus),OrderStatusEnum.Completed}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres1 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods_Order.OrderId),
FiledValue=OrderId,
OperatorEnum=OperatorEnum.Equal
......@@ -8210,12 +8223,15 @@ namespace Mall.Module.Product
if (disInfo != null && disInfo.AuditStatus == DistributorAuditStatusEnum.Audited)
{
//更新分销商佣金
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
Dictionary<string, object> keyValues2 = new Dictionary<string, object>()
{
{ nameof(RB_Distributor_Info_Extend.TotalCommission),(disInfo.TotalCommission??0)+(item.Commission??0)},
{ nameof(RB_Distributor_Info_Extend.CommissionWithdrawal),(disInfo.CommissionWithdrawal??0)+(item.Commission??0)},
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres2 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Distributor_Info_Extend.Id),
FiledValue=disInfo.Id,
OperatorEnum=OperatorEnum.Equal
......@@ -8225,12 +8241,15 @@ namespace Mall.Module.Product
if (flag1)
{
//更新返佣状态
Dictionary<string, object> keyValues3 = new Dictionary<string, object>() {
Dictionary<string, object> keyValues3 = new Dictionary<string, object>()
{
{ nameof(RB_Goods_OrderCommission_Extend.CommissionState),2},
{ nameof(RB_Goods_OrderCommission_Extend.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres3 = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres3 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods_OrderCommission_Extend.Id),
FiledValue=item.Id,
OperatorEnum=OperatorEnum.Equal
......@@ -8260,11 +8279,14 @@ namespace Mall.Module.Product
//保存积分赠送
var umodel = member_UserRepository.GetEntity(demodel.UserId);
//用户订单数增加
Dictionary<string, object> keyValues12 = new Dictionary<string, object>() {
Dictionary<string, object> keyValues12 = new Dictionary<string, object>()
{
{ nameof(RB_Member_User_Extend.Integral), (umodel.Integral ?? 0)+IntegralGoodsPresent }
};
List<WhereHelper> wheres12 = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres12 = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Member_User_Extend.Id),
FiledValue=umodel.Id,
OperatorEnum=OperatorEnum.Equal
......
......@@ -1807,23 +1807,28 @@ namespace Mall.Module.Product
model.Favorite = false;
if (UserId > 0)
{
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Member_Collection_Extend.UserId),
FiledValue=UserId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Member_Collection_Extend.GoodsId),
FiledValue=goodsId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Member_Collection_Extend.TenantId),
FiledValue=TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Member_Collection_Extend.MallBaseId),
FiledValue=MallBaseId,
OperatorEnum=OperatorEnum.Equal
......@@ -1995,23 +2000,28 @@ namespace Mall.Module.Product
else
{
//判断是否开启和平返佣
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Distributor_HPCommission.Status),
FiledValue=0,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Distributor_HPCommission.Enabled),
FiledValue=1,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Distributor_HPCommission.TenantId),
FiledValue=TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
new WhereHelper()
{
FiledName=nameof(RB_Distributor_HPCommission.MallBaseId),
FiledValue=MallBaseId,
OperatorEnum=OperatorEnum.Equal
......@@ -2475,7 +2485,8 @@ 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()
{
Sort = 0,
......@@ -2507,6 +2518,78 @@ namespace Mall.Module.Product
goodsPreferentialList = RB_Goods_PreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, GoodsId = model.Id });
//教育商品扩展对象属性
var eduDataJson = ParsingEduJsonModule(model.EduJsonData);
List<object> groupsList = new List<object>();
foreach (var x in model.SpecificationList)
{
//List<object> dateList = new List<object>();
List<object> attrList = new List<object>();
//日期格式
if (x.IsDateFormat == 1)
{
//List<DateItem> dateTimeList = new List<DateItem>();
foreach (var item in x.SpecificationValueList)
{
try
{
var newDateTime = Convert.ToDateTime(item.Name);
if (newDateTime > DateTime.Now)
{
//dateTimeList.Add(new DateItem()
//{
// YearStr = newDateTime.Year,
// MonthStr = newDateTime.ToString("MM"),
// DayStr = newDateTime.ToString("yyyy-MM-dd"),
//});
attrList.Add(new
{
attr_id = item.Sort,
attr_name = item.Name,
pic_url = item.ImagePath
});
}
}
catch
{
}
}
//var dateGroupList = dateTimeList.GroupBy(qitem => new { qitem.YearStr, qitem.MonthStr }).Select(qitem => new { qitem.Key.YearStr, qitem.Key.MonthStr });
//foreach (var item in dateGroupList)
//{
// var subList = dateTimeList?.Where(qitem => qitem.YearStr == item.YearStr && qitem.MonthStr == item.MonthStr)?.ToList();
// dateList.Add(new
// {
// yearstr = item.YearStr,
// monthstr = item.MonthStr,
// subList
// });
//}
}
else
{
foreach (var z in x.SpecificationValueList)
{
attrList.Add(new
{
attr_id = z.Sort,
attr_name = z.Name,
pic_url = z.ImagePath
});
}
}
groupsList.Add(new
{
isdateformat = x.IsDateFormat,
attr_group_id = x.Sort,
attr_group_name = x.Name,
//购买次数(进阶小课堂使用)
service_time = model.ServiceTime,
attr_list =attrList,
//dateList,
});
}
return new
{
goods = new
......@@ -2526,20 +2609,21 @@ namespace Mall.Module.Product
remark = model?.Remark ?? "",
edu_data = eduDataJson,
EduTeacherId = model?.EduTeacherId ?? 0,
attr_groups = model.SpecificationList.Select(x => new
{
isdateformat = x.IsDateFormat,
attr_group_id = x.Sort,
attr_group_name = x.Name,
//购买次数(进阶小课堂使用)
service_time = model.ServiceTime,
attr_list = x.SpecificationValueList.Select(z => new
{
attr_id = z.Sort,
attr_name = z.Name,
pic_url = z.ImagePath
})
}),
//attr_groups = model.SpecificationList.Select(x => new
//{
// isdateformat = x.IsDateFormat,
// attr_group_id = x.Sort,
// attr_group_name = x.Name,
// //购买次数(进阶小课堂使用)
// service_time = model.ServiceTime,
// attr_list = x.SpecificationValueList.Select(z => new
// {
// attr_id = z.Sort,
// attr_name = z.Name,
// pic_url = z.ImagePath
// })
//}),
attr_groups= groupsList,
attr = priceList,
goodsRelevanceList = goodsRelevanceList?.Select(qitem => new
{
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Collections.Generic;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
......
......@@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Mall.AOP;
using Consul;
namespace Mall.WebApi.Controllers.MallBase
{
......@@ -711,18 +712,19 @@ namespace Mall.WebApi.Controllers.MallBase
List<object> result = new List<object>();
foreach (var item in list)
{
if (item.Value=="1"|| item.Value == "5"|| item.Value == "6"|| item.Value == "7")
if (item.Value == "1" || item.Value == "5" || item.Value == "6" || item.Value == "7")
{
result.Add(new { Id = Convert.ToInt32(item.Value), Name = item.Key });
}
else if (item.Value == "3")
{
result.Add(new { Id = Convert.ToInt32(item.Value), Name ="待出团"});
result.Add(new { Id = Convert.ToInt32(item.Value), Name = "待出团" });
}
}
return ApiResult.Success("", result);
}
else {
else
{
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
......@@ -3467,7 +3469,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success("");
}
else {
else
{
return ApiResult.Failed(msg);
}
}
......@@ -4775,11 +4778,13 @@ namespace Mall.WebApi.Controllers.MallBase
#region 教育资产商品
[HttpPost]
public ApiResult SetEduGoodsFreightCostFinance() {
public ApiResult SetEduGoodsFreightCostFinance()
{
var userInfo = base.UserInfo;
var parm = JObject.Parse(base.RequestParm.msg.ToString());
int OrderId = parm.GetInt("OrderId", 0);
if (OrderId <= 0) {
if (OrderId <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -4788,11 +4793,110 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed(msg);
}
}
#endregion
#region 评论标签管理
/// <summary>
/// 新增修改评论标签
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCommentLabel()
{
var userInfo = base.UserInfo;
var parm = JObject.Parse(base.RequestParm.msg.ToString());
RB_Comment_Label_Extend extModel = new RB_Comment_Label_Extend()
{
Id = parm.GetInt("Id"),
Name = parm.GetStringValue("Name"),
Status = 0,
TenantId = userInfo.TenantId,
MallBaseId = userInfo.MallBaseId,
};
if (extModel.Id > 0)
{
extModel.UpdateDate = DateTime.Now;
}
else
{
extModel.CreateDate = DateTime.Now;
}
bool flag = orderModule.SetCommentLabelModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取评论标签
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCommentLabel()
{
var parm = JObject.Parse(base.RequestParm.msg.ToString());
int Id = parm.GetInt("Id");
var extModel = orderModule.GetCommentLabelModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 根据编号删除评论标签
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveCommentLabel()
{
var parm = JObject.Parse(base.RequestParm.msg.ToString());
int Id = parm.GetInt("Id");
var flag = orderModule.RemoveCommentLabelModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取评论标签分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCommentLabelPage()
{
var parm = JObject.Parse(base.RequestParm.msg.ToString());
ResultPageModel pageModel = new ResultPageModel()
{
pageIndex=parm.GetInt("pageIndex"),
pageSize=parm.GetInt("pageSize"),
};
var query = new RB_Comment_Label_Extend()
{
Name=parm.GetStringValue("Name"),
};
var dataList = orderModule.GetCommentLabelPageModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = dataList;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取评论标签列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCommentLabelList()
{
var parm = JObject.Parse(base.RequestParm.msg.ToString());
var query = new RB_Comment_Label_Extend()
{
Name = parm.GetStringValue("Name"),
};
var dataList = orderModule.GetCommentLabelListModule( query);
return ApiResult.Success(data: dataList);
}
#endregion
}
}
\ No newline at end of file
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