Commit a2e56b96 authored by 吴春's avatar 吴春

完善资讯和教师

parent 063519fe
......@@ -37,6 +37,16 @@ namespace Mall.Model.Extend.Product
/// </summary>
public List<string> LineDescriptionList { get; set; }
/// <summary>
/// 课程章节数
/// </summary>
public int CourseNum { get; set; }
/// <summary>
/// 教师id
/// </summary>
public int TeacherId { get; set; }
#region 司导信息
/// <summary>
/// 站点名称
......
......@@ -1155,6 +1155,37 @@ namespace Mall.Module.Education
return true;
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Goods_Extend> GetListByTeacherId(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend dmodel)
{
var list = goodsRepository.GetListByTeacherId(pageIndex, pageSize, out rowCount, dmodel);
if (list.Any())
{
foreach (var item in list)
{
//轮播图
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图
item.CoverImage = CarouselIdList[0];
}
}
}
return list;
}
#endregion
#region 小程序课程
......@@ -2143,6 +2174,7 @@ namespace Mall.Module.Education
{ nameof(RB_Education_Article_Extend.ShelvesDate),model.ShelvesDate},
{ nameof(RB_Education_Article_Extend.Sort),model.Sort},
{ nameof(RB_Education_Article_Extend.ArticlePic),model.ArticlePic},
{ nameof(RB_Education_Article_Extend.TeacherId),model.TeacherId},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
......
......@@ -1148,5 +1148,78 @@ where {where} GROUP BY g.Id asc order by {orderBy} ,b.date asc";
}
#endregion
#region 网课教育
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Goods_Extend> GetListByTeacherId(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend dmodel)
{
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and g.GoodsClassify=2 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1 and b.`Status`=0";
if (dmodel.TenantId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.NotTenantId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}<>{dmodel.NotTenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds))
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and g.{nameof(RB_Goods_Extend.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.IsSelectSellOut == 1)
{
where += $@" and g.{nameof(RB_Goods_Extend.InventoryNum)}<=0";
}
if (!string.IsNullOrEmpty(dmodel.CategoryIds))
{
where += $@" and c.{nameof(RB_Goods_Category.CategoryId)} in({dmodel.CategoryIds})";
}
if (dmodel.IsProcurement > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}";
}
if (dmodel.IsProxy > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.IsProxy)}={dmodel.IsProxy}";
}
if (dmodel.SupplierId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
}
if (dmodel.TeacherId > 0)
{
where += $@" and b.{nameof(RB_Goods_Extend.TeacherId)}={dmodel.TeacherId}";
}
string orderBy = " g.Sort desc";
string sql = $@" SELECT g.*,c.CourseNum from rb_goods as g
LEFT JOIN rb_goods_wk_teacher as b on g.Id=b.GoodsId
LEFT JOIN (SELECT GoodsId,COUNT(*) as CourseNum from rb_goods_wk_course where `Status`=0 GROUP BY GoodsId) as c on c.GoodsId=g.Id where {where} order by {orderBy}";
return GetPage<RB_Goods_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
#endregion
}
}
......@@ -70,7 +70,7 @@ namespace Mall.WebApi.Controllers.Education
{
#region 组装价格
List<object> priceList = new List<object>();
decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
......@@ -113,7 +113,7 @@ namespace Mall.WebApi.Controllers.Education
},
price_member
});
#endregion
#region 会员价格
......@@ -268,12 +268,12 @@ namespace Mall.WebApi.Controllers.Education
{
educationModule.UpdateArticleBrowseNum(oldLogisticsModel);
}
}
catch (Exception ex)
{
}
return ApiResult.Success("", oldLogisticsModel);
}
......@@ -322,6 +322,48 @@ namespace Mall.WebApi.Controllers.Education
#endregion
#region 教师
/// <summary>
/// 获取详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTeacherModel(object requestMsg)
{
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
var query = JsonConvert.DeserializeObject<RB_Education_Teacher_Extend>(parms.msg.ToString());
query.TenantId = parms.TenantId;
query.MallBaseId = parms.MallBaseId;
query.TeacherStatus = 1;
var oldLogisticsModel = educationModule.GetTeacherModel(query);
if (oldLogisticsModel == null)
{
oldLogisticsModel = new RB_Education_Teacher_Extend();
}
if (!string.IsNullOrWhiteSpace(oldLogisticsModel.LableName))
{
oldLogisticsModel.LableNameList = JsonConvert.DeserializeObject<List<string>>(oldLogisticsModel.LableName);
}
//获取老师对应的课程
var goodsList = educationModule.GetListByTeacherId(1, 4, out long count, new RB_Goods_Extend { TeacherId = oldLogisticsModel.ID, TenantId = oldLogisticsModel.TenantId, MallBaseId = oldLogisticsModel.MallBaseId });
var goodsResult = goodsList.Select(x => new
{
x.CoverImage,
x.Name,
x.CourseNum
});
var teacherResult = new {
oldLogisticsModel?.WorkYears,
oldLogisticsModel?.Major,
oldLogisticsModel?.LableNameList,
oldLogisticsModel?.Name,
oldLogisticsModel?.TeacherLogo,
oldLogisticsModel?.Introduction
};
return ApiResult.Success("", new { teacherResult, goodsResult });
}
#endregion
}
}
\ No newline at end of file
......@@ -776,6 +776,7 @@ namespace Mall.WebApi.Controllers.Education
/// 获取详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetTeacherModel()
{
var parms = RequestParm;
......@@ -1508,7 +1509,7 @@ namespace Mall.WebApi.Controllers.Education
{
return ApiResult.Failed("请输入资讯标题");
}
if (string.IsNullOrWhiteSpace(query.LableName))
if (query.LableNameList==null|| !query.LableNameList.Any())
{
return ApiResult.Failed("请输入标签");
}
......
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