Commit 956cf337 authored by liudong1993's avatar liudong1993

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

parents 99505546 e0aded45
......@@ -18,9 +18,9 @@ namespace Mall.Common.Enum.MallBase
[EnumField("七牛云存储")]
QiNiu = 2,
/// <summary>
/// 自定义存储
/// 阿里云
/// </summary>
[EnumField("自定义存储")]
Other = 3
[EnumField("阿里云")]
Alicloud = 3
}
}
......@@ -31,7 +31,7 @@ namespace Mall.Model.Entity.Education
public int Status { get; set; }
public DateTime CreateDate { get; set; }
public DateTime? CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
......
......@@ -72,5 +72,10 @@ namespace Mall.Model.Entity.Education
public decimal Score { get; set; }
/// <summary>
/// 从业年限
/// </summary>
public decimal WorkYears { get; set; }
}
}
......@@ -17,5 +17,24 @@ namespace Mall.Model.Extend.Education
/// 资讯标题
/// </summary>
public string ArticleName { get; set; }
/// <summary>
/// 评论图片列表
/// </summary>
public List<string> CommentImgList { get; set; }
/// <summary>
/// 头像路径
/// </summary>
public string UserPhotoPath { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
}
}
\ No newline at end of file
......@@ -2219,4 +2219,56 @@ namespace Mall.Model.Extend.MarketingCenter
/// </summary>
public string PaddingRight { get; set; }
}
/// <summary>
/// 教育模块-最近学习组件
/// </summary>
public class educationItem
{
/// <summary>
/// 封面
/// </summary>
public string Cover { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 进度
/// </summary>
public string Progress { get; set; }
/// <summary>
/// 上边距
/// </summary>
public string PaddingTop { get; set; }
/// <summary>
/// 下边距
/// </summary>
public string PaddingBottom { get; set; }
/// <summary>
/// 左边距
/// </summary>
public string PaddingLeft { get; set; }
/// <summary>
/// 右边距
/// </summary>
public string PaddingRight { get; set; }
/// <summary>
/// 按钮位置
/// </summary>
public string BtnPosition { get; set; }
}
}
\ No newline at end of file
......@@ -2076,7 +2076,7 @@ namespace Mall.Module.Education
{
Dictionary<string, object> cols = new Dictionary<string, object>()
{
{ nameof(RB_Education_Article.Status),0},
{ nameof(RB_Education_Article.Status),1},
{ nameof(RB_Education_Article.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
......@@ -2112,17 +2112,115 @@ namespace Mall.Module.Education
#endregion
#region 教育-资讯评论管理
/// <summary>
/// 获取分页列表
/// 获取订单评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Education_ArticleComment_Extend> GetArticleCommentPageList(int pageIndex, int pageSize, out long count, RB_Education_ArticleComment_Extend demodel)
{
var list = educationArticleCommentRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any())
{
foreach (var item in list)
{
//评论图片
item.CommentImgList = new List<string>();
if (!string.IsNullOrEmpty(item.CommentImage))
{
item.CommentImgList = JsonConvert.DeserializeObject<List<string>>(item.CommentImage);
}
}
}
return list;
}
/// <summary>
/// 管理新增评论
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetArticleCommentInfo(RB_Education_ArticleComment_Extend demodel)
{
bool flag = educationArticleCommentRepository.Insert(demodel) > 0;
return flag;
}
/// <summary>
/// 批量操作
/// </summary>
/// <param name="commentIds"></param>
/// <param name="type"></param>
/// <param name="content"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Education_ArticleComment_Extend> GetPageList(int pageIndex, int pageSize, out long count, RB_Education_ArticleComment_Extend dmodel)
public bool SetArticleCommentBatch(string commentIds, int type, string content, int tenantId, int mallBaseId)
{
return educationArticleCommentRepository.GetPageList(pageIndex, pageSize, out count, dmodel);
//1批量回复 2批量隐藏 3批量显示 4批量置顶 5取消置顶 6批量删除
Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
if (type == 1)
{ //回复
keyValues.Add(nameof(RB_Education_ArticleComment.Reply), content);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else if (type == 2)
{ //影藏
keyValues.Add(nameof(RB_Education_ArticleComment.Is_Show), 2);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else if (type == 3)
{
keyValues.Add(nameof(RB_Education_ArticleComment.Is_Show), 1);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else if (type == 4)
{
keyValues.Add(nameof(RB_Education_ArticleComment.Is_Top), 1);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else if (type == 5)
{
keyValues.Add(nameof(RB_Education_ArticleComment.Is_Top), 2);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else if (type == 6)
{
keyValues.Add(nameof(RB_Education_ArticleComment.Status), 1);
keyValues.Add(nameof(RB_Education_ArticleComment.UpdateDate), DateTime.Now);
}
else
{
return false;
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Education_ArticleComment.ID),
FiledValue=commentIds,
OperatorEnum=OperatorEnum.IN
},
new WhereHelper(){
FiledName=nameof(RB_Education_ArticleComment.TenantId),
FiledValue=tenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Education_ArticleComment.MallBaseId),
FiledValue=mallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
return educationArticleCommentRepository.Update(keyValues, wheres);
}
#endregion
......
......@@ -40,10 +40,18 @@ namespace Mall.Repository.Education
{
where += $@" and c.{nameof(RB_Education_ArticleComment.ID)}={dmodel.ID}";
}
if (dmodel.UserId > 0)
{
where += $@" and c.{nameof(RB_Education_ArticleComment.UserId)}={dmodel.UserId}";
}
if (dmodel.CommentGrade > 0)
{
where += $@" and c.{nameof(RB_Education_ArticleComment.CommentGrade)}={(int)dmodel.CommentGrade}";
}
if (dmodel.ArticleId > 0)
{
where += $@" and c.{nameof(RB_Education_ArticleComment.ArticleId)}={dmodel.ArticleId}";
}
if (dmodel.PlatformSource > 0)
{
where += $@" and c.{nameof(RB_Education_ArticleComment.PlatformSource)}={(int)dmodel.PlatformSource}";
......@@ -60,7 +68,14 @@ namespace Mall.Repository.Education
{
where += $@" and c.{nameof(RB_Education_ArticleComment.Content)} like '%{dmodel.Content}%'";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and g.{nameof(RB_Education_ArticleComment.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and g.{nameof(RB_Education_ArticleComment.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
}
string sql = $@"SELECT c.*,g.Name as ArticleName FROM {TableName} c
left join rb_education_article g on c.ArticleId = g.Id
where {where} order by c.Id desc";
......
......@@ -27,36 +27,37 @@ namespace Mall.Repository.Education
public List<RB_Education_Article_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Education_Article_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Education_Article_Extend.Status)}=0");
builder.Append(@$" SELECT a.* FROM {TableName} as a LEFT JOIN (SELECT ArticleId,COUNT(*) as CommentNum from rb_education_articlecomment where `Status`=0 GROUP BY ArticleId )
as b on a.ID = b.ArticleId WHERE a.{nameof(RB_Education_Article_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Education_Article_Extend.TenantId)}={query.TenantId}");
builder.Append($" AND a.{nameof(RB_Education_Article_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Education_Article_Extend.MallBaseId)}={query.MallBaseId}");
builder.Append($" AND a.{nameof(RB_Education_Article_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_Education_Article_Extend.ID)}={query.ID}");
builder.Append($" AND a.{nameof(RB_Education_Article_Extend.ID)}={query.ID}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_Education_Article_Extend.Name)} like '%{query.Name}%'");
builder.Append($" AND a.{nameof(RB_Education_Article_Extend.Name)} like '%{query.Name}%'");
}
if (query.ArticleStatus > 0)
{
builder.Append($" AND {nameof(RB_Education_Article_Extend.ArticleStatus)}={query.ArticleStatus}");
builder.Append($" AND a.{nameof(RB_Education_Article_Extend.ArticleStatus)}={query.ArticleStatus}");
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.Append($" and g.{nameof(RB_Education_Article_Extend.CreateDate)} >='{query.StartTime}'");
builder.Append($" and a.{nameof(RB_Education_Article_Extend.CreateDate)} >='{query.StartTime}'");
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.Append($" and g.{nameof(RB_Education_Article_Extend.CreateDate)} <='{query.EndTime + " 23:59:59"}'");
builder.Append($" and a.{nameof(RB_Education_Article_Extend.CreateDate)} <='{query.EndTime + " 23:59:59"}'");
}
}
return GetPage<RB_Education_Article_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
......
......@@ -719,7 +719,8 @@ namespace Mall.WebApi.Controllers.Education
CreateDateStr = x.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
x.TeacherStatus,
x.Telephone,
x.Major
x.Major,
x.WorkYears
});
return ApiResult.Success("", pagelist);
......@@ -1500,5 +1501,134 @@ namespace Mall.WebApi.Controllers.Education
}
}
#endregion
#region 咨询评价
/// <summary>
/// 获取商品评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetArticleCommentPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Education_ArticleComment_Extend demodel = JsonConvert.DeserializeObject<RB_Education_ArticleComment_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = educationModule.GetArticleCommentPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.ID,
x.UserId,
x.UserName,
x.ArticleId,
x.ArticleName,
x.CommentScore,
x.CommentGrade,
CommentGradeName = x.CommentGrade.GetEnumName(),
x.CommentImgList,
x.Content,
x.Reply,
x.Is_Top,
x.Is_Show,
x.Is_Anonymity,
x.PlatformSource,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 管理新增评论
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetArticleCommentInfo()
{
var req = RequestParm;
RB_Education_ArticleComment_Extend demodel = JsonConvert.DeserializeObject<RB_Education_ArticleComment_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.UserName))
{
return ApiResult.ParamIsNull("请输入用户名称");
}
if (!demodel.CreateDate.HasValue)
{
return ApiResult.ParamIsNull("请输入评论时间");
}
if (demodel.ArticleId <= 0)
{
return ApiResult.ParamIsNull("请选择咨询文章");
}
if (string.IsNullOrEmpty(demodel.Content))
{
return ApiResult.ParamIsNull("请输入评价内容");
}
if (!demodel.CommentScore.HasValue)
{
return ApiResult.ParamIsNull("请选择评分");
}
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.CommentImage = "";
if (demodel.CommentImgList != null && demodel.CommentImgList.Any())
{
demodel.CommentImage = JsonConvert.SerializeObject(demodel.CommentImgList);
}
demodel.UserPhoto ??= 0;
demodel.Is_Top ??= 2;
demodel.Is_Show ??= 1;
demodel.Is_Anonymity ??= 2;
demodel.UserId ??= 0;
demodel.Reply ??= "";
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.Status = 0;
demodel.UpdateDate = DateTime.Now;
bool flag = educationModule.SetArticleCommentInfo(demodel);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
/// 批量操作
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetArticleCommentBatch()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string CommentIds = parms.GetStringValue("CommentIds");
int Type = parms.GetInt("Type", 1);//1批量回复 2批量隐藏 3批量显示 4批量置顶 5取消置顶 6批量删除
string Content = parms.GetStringValue("Content");
if (string.IsNullOrEmpty(CommentIds))
{
return ApiResult.ParamIsNull();
}
if (Type == 1)
{
if (string.IsNullOrEmpty(Content))
{
return ApiResult.ParamIsNull("回复内容不能为空");
}
}
bool flag = educationModule.SetArticleCommentBatch(CommentIds, Type, Content, req.TenantId, req.MallBaseId);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
#endregion
}
}
\ No newline at end of file
......@@ -966,6 +966,25 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("获取成功", model);
}
/// <summary>
/// 获取触发事件枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStoreTypeEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MallBase.StoreTypeEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
#endregion
#region 包邮规则
......
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