Commit cd9a2c84 authored by liudong1993's avatar liudong1993

章节是否已学习

parent 5f0e1e07
...@@ -18,6 +18,10 @@ namespace Mall.Model.Extend.Product ...@@ -18,6 +18,10 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public string GoodsIds { get; set; } public string GoodsIds { get; set; }
/// <summary> /// <summary>
/// 课程章节ids
/// </summary>
public string CourseIds { get; set; }
/// <summary>
/// 总章节 /// 总章节
/// </summary> /// </summary>
public int TNum { get; set; } public int TNum { get; set; }
......
...@@ -17,6 +17,10 @@ namespace Mall.Model.Extend.Product ...@@ -17,6 +17,10 @@ namespace Mall.Model.Extend.Product
/// 商品ids /// 商品ids
/// </summary> /// </summary>
public string GoodsIds { get; set; } public string GoodsIds { get; set; }
/// <summary>
/// 是否已阅读 1是 2否
/// </summary>
public int IsRead { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -172,10 +172,6 @@ namespace Mall.Module.Product ...@@ -172,10 +172,6 @@ namespace Mall.Module.Product
private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository(); private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository();
/// <summary>
/// 微店基础
/// </summary>
private RB_SmallShops_CustomRepository smallShops_CustomRepository = new RB_SmallShops_CustomRepository();
/// <summary> /// <summary>
/// 微店 /// 微店
/// </summary> /// </summary>
...@@ -192,6 +188,10 @@ namespace Mall.Module.Product ...@@ -192,6 +188,10 @@ namespace Mall.Module.Product
/// 教师 /// 教师
/// </summary> /// </summary>
private readonly RB_Goods_WK_TeacherRepository goods_WK_TeacherRepository = new RB_Goods_WK_TeacherRepository(); private readonly RB_Goods_WK_TeacherRepository goods_WK_TeacherRepository = new RB_Goods_WK_TeacherRepository();
/// <summary>
/// 网课学习
/// </summary>
private readonly RB_Goods_WK_CourseStudyRepository goods_WK_CourseStudyRepository = new RB_Goods_WK_CourseStudyRepository();
...@@ -3446,10 +3446,20 @@ namespace Mall.Module.Product ...@@ -3446,10 +3446,20 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param> /// <param name="tenantId"></param>
/// <param name="mallBaseId"></param> /// <param name="mallBaseId"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_WK_Course_Extend> GetAppletGoodsCourseList(int pageIndex, int pageSize, out long count, int goodsId, int tenantId, int mallBaseId) public List<RB_Goods_WK_Course_Extend> GetAppletGoodsCourseList(int pageIndex, int pageSize, out long count, int goodsId,int userId, int tenantId, int mallBaseId)
{ {
var list = goods_WK_CourseRepository.GetPageList(pageIndex, pageSize, out count, new RB_Goods_WK_Course_Extend() { GoodsId = goodsId, TenantId = tenantId, MallBaseId = mallBaseId }); var list = goods_WK_CourseRepository.GetPageList(pageIndex, pageSize, out count, new RB_Goods_WK_Course_Extend() { GoodsId = goodsId, TenantId = tenantId, MallBaseId = mallBaseId });
//查询观看数量 if (userId > 0 && list.Any()) {
//查询用户课程章节 阅读情况
var slist = goods_WK_CourseStudyRepository.GetList(new RB_Goods_WK_CourseStudy_Extend() { UserId = userId, CourseIds = string.Join(",", list.Select(x => x.Id)) });
foreach (var item in list) {
item.IsRead = 2;
if (slist.Where(x => x.CourseId == item.Id).Any())
{
item.IsRead = 1;//已阅读
}
}
}
return list; return list;
} }
......
...@@ -36,6 +36,9 @@ namespace Mall.Repository.Product ...@@ -36,6 +36,9 @@ namespace Mall.Repository.Product
if (!string.IsNullOrEmpty(dmodel.GoodsIds)) { if (!string.IsNullOrEmpty(dmodel.GoodsIds)) {
where += $@" and gc.{nameof(RB_Goods_WK_CourseStudy.GoodsId)} in({dmodel.GoodsIds})"; where += $@" and gc.{nameof(RB_Goods_WK_CourseStudy.GoodsId)} in({dmodel.GoodsIds})";
} }
if (!string.IsNullOrEmpty(dmodel.CourseIds)) {
where += $@" and gc.{nameof(RB_Goods_WK_CourseStudy.CourseId)} in({dmodel.CourseIds})";
}
string sql = $@" string sql = $@"
SELECT gc.* FROM RB_Goods_WK_CourseStudy gc SELECT gc.* FROM RB_Goods_WK_CourseStudy gc
......
...@@ -199,7 +199,7 @@ namespace Mall.WebApi.Controllers.Education ...@@ -199,7 +199,7 @@ namespace Mall.WebApi.Controllers.Education
{ {
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
var list = productModule.GetAppletGoodsCourseList(pagelist.pageIndex, pagelist.pageSize, out long count, GoodsId, req.TenantId, req.MallBaseId); var list = productModule.GetAppletGoodsCourseList(pagelist.pageIndex, pagelist.pageSize, out long count, GoodsId, req.UserId, req.TenantId, req.MallBaseId);
bool IsPay = productModule.GetAppletCourseIsPay(GoodsId, req.UserId); bool IsPay = productModule.GetAppletCourseIsPay(GoodsId, req.UserId);
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
...@@ -219,6 +219,7 @@ namespace Mall.WebApi.Controllers.Education ...@@ -219,6 +219,7 @@ namespace Mall.WebApi.Controllers.Education
x.VideoImage, x.VideoImage,
x.VideoTime, x.VideoTime,
IsPay, IsPay,
x.IsRead,
ImageList = GetCourseImage(x.IsTrySee ?? 0, IsPay, x.Number ?? 0, x.Image) ImageList = GetCourseImage(x.IsTrySee ?? 0, IsPay, x.Number ?? 0, x.Image)
}); });
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
......
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