Commit d423092a authored by 黄奎's avatar 黄奎

页面修改

parent d7cb5ece
......@@ -33,6 +33,14 @@ namespace EduSpider.IRepository
/// <returns></returns>
public bool SetStuCommentShowTypeRepository(int ShowType, string Ids);
/// <summary>
/// 修改学员评论状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimesRepository(int CourseId,int Times,int ShowType);
/// <summary>
/// 根据编号删除学员评论
/// </summary>
......
......@@ -102,6 +102,15 @@ namespace EduSpider.IServices
/// <returns></returns>
public bool SetStuCommentShowType(int ShowType, string Ids);
/// <summary>
/// 根据课程评论次数修改可见等级
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimes(int CourseId, int Times, int ShouType);
/// <summary>
/// 根据编号删除学员评论
/// </summary>
......
......@@ -49,5 +49,10 @@
/// 创建类型(1-系统创建,2-老师创建)
/// </summary>
public int CreateCommentType { get; set; }
/// <summary>
/// 评论次数
/// </summary>
public int CommentTimes { get; set; }
}
}
......@@ -44,6 +44,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stu_Comment.HomeWorkId), query.HomeWorkId);
}
if (query.CommentTimes > 0)
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Stu_Comment.Times), query.CommentTimes);
}
}
return Get<RB_Stu_Comment>(builder.ToString()).ToList();
}
......@@ -85,6 +89,19 @@ WHERE 1=1
return base.Execute(sql) > 0;
}
/// <summary>
/// 根据课程评论次数修改可见等级
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimesRepository(int CourseId, int Times, int ShowType)
{
string sql = string.Format("UPDATE RB_Stu_Comment SET ShowType={0} WHERE CourseId={1} AND Times={2}", ShowType, CourseId, Times);
return base.Execute(sql) > 0;
}
/// <summary>
/// 根据编号删除学员评论
/// </summary>
......
......@@ -368,6 +368,18 @@ namespace EduSpider.Services
return StuCommentRepository.SetStuCommentShowTypeRepository(ShowType, Ids);
}
/// <summary>
/// 修改学员评论状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public bool SetStuCommentShowTypeByTimes(int CourseId,int Times,int ShowType)
{
return StuCommentRepository.SetStuCommentShowTypeByTimesRepository(CourseId, Times, ShowType);
}
/// <summary>
/// 根据编号删除学员评论
/// </summary>
......@@ -385,7 +397,33 @@ namespace EduSpider.Services
/// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesList(CourseQuery query)
{
return StuCommentRepository.GetCourseCommentTimesListRepository(query);
var list= StuCommentRepository.GetCourseCommentTimesListRepository(query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
int ShowType = 3;
var subList = StuCommentRepository.GetStuCommentListRepository(new CourseQuery() { CourseId = item.CourseId, CommentTimes = item.Times });
if (subList != null&& subList.Count>0)
{
var totalCount = subList.Count();
if (subList.Where(qitem => qitem.ShowType == 1).Count() == totalCount)
{
ShowType = 1;
}
else if (subList.Where(qitem => qitem.ShowType == 3).Count() == totalCount)
{
ShowType = 3;
}
else
{
ShowType = 2;
}
}
item.ShowType = ShowType;
}
}
return list;
}
}
......
......@@ -272,6 +272,21 @@ namespace EduSpider.WebApi.Controllers
}
[HttpPost]
[HttpGet]
/// <summary>
/// 设置学员评论可见性
/// </summary>
/// <returns></returns>
public ApiResult SetStuCommentShowTypeByTimes()
{
int CourseId = base.ReqParameters.GetInt("CourseId");
int Times = base.ReqParameters.GetInt("Times");
int ShowType = base.ReqParameters.GetInt("ShowType");
var flag = CourseService.SetStuCommentShowTypeByTimes(CourseId,Times,ShowType); ;
return flag ? ApiResult.Success() : ApiResult.Failed();
}
[HttpPost]
[HttpGet]
......@@ -286,8 +301,39 @@ namespace EduSpider.WebApi.Controllers
CourseId = base.ReqParameters.GetInt("CourseId"),
CreateCommentType=1
};
List<object> result = new List<object>();
var list = CourseService.GetCourseCommentTimesList(query);
return ApiResult.Success(data: list);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
string ShowTypeStr = "";
if (item.ShowType == 1)
{
ShowTypeStr = "全部可见";
}
else if (item.ShowType == 2)
{
ShowTypeStr = "部分可见";
}
else if (item.ShowType == 3)
{
ShowTypeStr = "不可见";
}
result.Add(new
{
item.Times,
item.CourseId,
item.CreateType,
CreateTypeStr = item.CreateType == 1 ? "系统创建" : "老师创建",
item.ShowType,
ShowTypeStr,
CreateTime=VTX.FW.Helper.ConvertHelper.FormatDate(item.CreateTime),
optionsShow=false,
});
}
}
return ApiResult.Success(data: result);
}
[HttpPost]
......
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