Commit 670cf83e authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 82602540 f38ab601
......@@ -77,9 +77,14 @@ namespace Edu.Model.Entity.Exam
/// 考试状态(见枚举)
/// </summary>
public ExamTestStatusEnum ExamStatus { get; set; }
/// <summary>
/// 学员考试开始时间
/// </summary>
public DateTime? ExamStartTime { get; set; }
/// <summary>
/// 考试结束时间
/// 学员考试结束时间
/// </summary>
public DateTime? ExamEndTime { get; set; }
......
......@@ -86,6 +86,11 @@ namespace Edu.Model.ViewModel.Course
/// 当前课时(累加计算)
/// </summary>
public double CurrentHours { get; set; }
/// <summary>
/// 章节单词
/// </summary>
public List<RB_Course_Words_Extend> WordsList { get; set; }
}
}
......@@ -33,5 +33,10 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 创建时间查询
/// </summary>
public string QCreateTime { get; set; }
}
}
This diff is collapsed.
......@@ -18,6 +18,20 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_Course_WordsRepository course_WordsRepository = new RB_Course_WordsRepository();
/// <summary>
/// 获取课程单词分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Words_Extend> GetCourseWordsPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Course_Words_Extend query)
{
var list = course_WordsRepository.GetCourseWordsPageRepository(pageIndex, pageSize, out rowsCount, query);
return list;
}
/// <summary>
/// 获取课程单词列表
/// </summary>
......
......@@ -1625,6 +1625,28 @@ namespace Edu.Module.Exam
};
}
/// <summary>
/// 更新学员考试考试时间
/// </summary>
/// <param name="PublishId"></param>
/// <param name="GuestId"></param>
/// <param name="PaperId"></param>
/// <returns></returns>
public virtual bool SetStuExamStartTimeModule(int PublishId, int GuestId, int PaperId)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Student_ViewModel.ExamStartTime), DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PaperId),PaperId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PublishId),PublishId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.GuestId),GuestId),
};
bool flag = examination_StudentRepository.Update(fileds, wheres);
return flag;
}
/// <summary>
/// 学员提交考试
......
......@@ -23,11 +23,7 @@ namespace Edu.Repository.Course
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_course_chapter
WHERE 1=1
");
builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal));
if (query != null)
{
......@@ -43,11 +39,33 @@ namespace Edu.Repository.Course
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Course_Chapter_ViewModel.CourseId), query.CourseIds);
}
if (!string.IsNullOrEmpty(query.QCreateTime))
{
builder.AppendFormat(" AND {0}>='{1}' ", nameof(RB_Course_Chapter_ViewModel.CreateTime), query.QCreateTime);
}
}
//builder.AppendFormat(" ORDER BY {0} ",nameof(RB_Course_Chapter_ViewModel.ChapterNo));
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 批量插入
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public bool SetBatchInsertCourseChapterRepository(List<RB_Course_Chapter_ViewModel> param)
{
StringBuilder builder = new StringBuilder();
builder.Append("INSERT INTO rb_course_chapter (CourseId, ChapterNo, ChapterName,ChapterContent,ParentId,OpenStatus,Progress,CreateBy,CreateTime,UpdateBy,UpdateTime,Status,School_Id,Group_Id,SortNum,StudyHours,Objectives,Requirement,CourseRate,StudyMinutes,CurrentHours) VALUES");
param.ForEach(x =>
{
var newChapterNo = x.ChapterNo.Replace(".", "");
double.TryParse(newChapterNo, out double SortNum);
builder.Append($"({x.CourseId},'{x.ChapterNo}','{x.ChapterName}','{x.ChapterContent}',{x.ParentId},{x.OpenStatus},{x.Progress},{x.CreateBy},'{x.CreateTime}',{x.UpdateBy},'{x.UpdateTime}',{(int)x.Status},{x.School_Id},{x.Group_Id},{x.SortNum},{x.StudyHours},'{x.Objectives}','{x.Requirement}',{(int)x.CourseRate},{x.StudyMinutes},{x.CurrentHours}),");
});
builder = builder.Remove(builder.Length - 1, 1);
return base.Execute(builder.ToString()) > 0;
}
/// <summary>
/// 批量更新编号
/// </summary>
......@@ -68,6 +86,11 @@ namespace Edu.Repository.Course
return Execute(builder.ToString()) > 0;
}
/// <summary>
/// 批量插入当前课时
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public bool SetBatchCurrentHoursRepository(List<RB_Course_Chapter_ViewModel> param)
{
StringBuilder builder = new StringBuilder();
......@@ -93,7 +116,6 @@ namespace Edu.Repository.Course
builder.AppendFormat("set {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseRate), EnumHelper.ToInt(model.CourseRate));
builder.AppendFormat(" where {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), model.CourseId);
builder.AppendFormat(" and {0} like '{1}%'", nameof(RB_Course_Chapter_ViewModel.ChapterNo), model.ChapterNo);
return Execute(builder.ToString()) > 0;
}
......@@ -109,7 +131,6 @@ namespace Edu.Repository.Course
builder.AppendFormat("set {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Delete));
builder.AppendFormat(" where {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), model.CourseId);
builder.AppendFormat(" and ({0} like '{1}%' or {2}={3})", nameof(RB_Course_Chapter_ViewModel.ChapterNo), model.ChapterNo, nameof(RB_Course_Chapter_ViewModel.ChapterId), model.ChapterId);
return Execute(builder.ToString()) > 0;
}
......@@ -123,15 +144,10 @@ namespace Edu.Repository.Course
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_course_chapter
WHERE 1=1
");
builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId);
builder.AppendFormat(" AND ({0}='{1}' or {2} like '{3}.%')", nameof(RB_Course_Chapter_ViewModel.ChapterNo), currentHours, nameof(RB_Course_Chapter_ViewModel.ChapterNo), currentHours);
//builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours));
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
......@@ -146,11 +162,7 @@ namespace Edu.Repository.Course
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_course_chapter
WHERE 1=1
");
builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId);
if (!string.IsNullOrWhiteSpace(currentHours))
......@@ -167,15 +179,9 @@ namespace Edu.Repository.Course
builder.AppendFormat(" Or ");
}
}
builder.AppendFormat(" )");
}
//builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours));
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
}
\ No newline at end of file
......@@ -13,6 +13,43 @@ namespace Edu.Repository.Course
/// </summary>
public class RB_Course_WordsRepository : BaseRepository<RB_Course_Words>
{
/// <summary>
/// 获取课程单词分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Words_Extend> GetCourseWordsPageRepository(int pageIndex,int pageSize,out long rowsCount, RB_Course_Words_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Course_Words AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Words_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Words_Extend.Group_Id), query.Group_Id);
}
if (query.CourseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Words_Extend.CourseId), query.CourseId);
}
if (!string.IsNullOrEmpty(query.QCourseIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Course_Words_Extend.CourseId), query.QCourseIds);
}
}
return GetPage<RB_Course_Words_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取课程单词列表
/// </summary>
......
using Edu.Model.ViewModel.User;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.User;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
......@@ -111,18 +112,17 @@ namespace Edu.ThirdCore.TenCloud
/// 获取电话客服的Token
/// </summary>
/// <returns></returns>
public async Task<object> GetTenCccUserToken(string mail)
public async Task<TenCccTokenItem> GetTenCccUserToken(string mail)
{
var credential = TenCloudCredential._instance;
var tenCccTokenItem = new TenCccTokenItem();
CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest();
req.SdkAppId = SDKAPPID;
req.SeatUserId = mail;
CreateSDKLoginTokenResponse resp = credential.CreateSDKLoginTokenSync(req);
return new
{
SdkURL = resp.SdkURL,
Token = resp.Token
};
tenCccTokenItem.SdkURL = resp.SdkURL;
tenCccTokenItem.Token = resp.Token;
return tenCccTokenItem;
}
}
......
......@@ -961,6 +961,21 @@ namespace Edu.WebApi.Controllers.Applet
return ApiResult.Success(data: data);
}
/// <summary>
/// 更新学员开始考试时间
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetStuExamStartTime()
{
var PublishId = base.ParmJObj.GetInt("PublishId");
var GuestId = base.ParmJObj.GetInt("GuestId", 0);
var PaperId = base.ParmJObj.GetInt("PaperId");
var Exam_Student_Id = base.ParmJObj.GetInt("Exam_Student_Id");
bool flag = paperModule.SetStuExamStartTimeModule(PublishId, GuestId, PaperId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 学生提交答卷
/// </summary>
......
......@@ -1731,12 +1731,8 @@ namespace Edu.WebApi.Controllers.Course
itemDetails.DurationEndTime = startTime.AddMinutes(tempDuration).ToString("HH:mm");
}
}
item.LessonPlanProjectsList = projectList.Where(x => x.LessonPlanId == item.LessonPlanId).ToList();
// item.LessonPlanProjectsList.ForEach(x => x.ProjectContentList = (string.IsNullOrWhiteSpace(x.ProjectContent) ? new List<string>() : Common.Plugin.JsonHelper.DeserializeObject<List<string>>(x.ProjectContent)));
model.IsEditSummary += item.LessonPlanDetailsList.Where(x => !string.IsNullOrWhiteSpace(x.Summary)).Count();
}
}
}
......@@ -1745,19 +1741,15 @@ namespace Edu.WebApi.Controllers.Course
model.LessonPlanList = new List<RB_Class_LessonPlan_ViewModel>
{
new RB_Class_LessonPlan_ViewModel { CourseName = "备课信息", LessonPlanDetailsList = new List<RB_Class_LessonPlanDetails_ViewModel>(), LessonPlanProjectsList = new List<RB_Class_LessonPlanProjects_ViewModel>() },
//new RB_Class_LessonPlan_ViewModel { CourseName = "理解篇", LessonPlanDetailsList = new List<RB_Class_LessonPlanDetails_ViewModel>(), LessonPlanProjectsList = new List<RB_Class_LessonPlanProjects_ViewModel>() }
};
}
#region 追加章节信息
var hours = classModule.GetCurrentPlanStudyHoursRepository(model.ClassPlanId) + 1;
if (hours != -1)
{
var classObj = classModule.GetClassModule(model.ClassId);
var courseOjb = new CourseModule().GetCourseModule(classObj.CouseId);
var chapter = new CourseModule().GetMatchHoursChapterModule(classObj.CouseId, hours);
if (chapter != null && chapter.Count > 0)
{
......@@ -1765,9 +1757,7 @@ namespace Edu.WebApi.Controllers.Course
}
model.CourseName = courseOjb.CourseName;
}
#endregion
return ApiResult.Success("", model);
}
......
......@@ -583,7 +583,7 @@ namespace Edu.WebApi.Controllers.Course
#region 课程章节管理
/// <summary>
/// 导入课程章节到新课程
/// 导入课程章节和单词到新课程
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -598,12 +598,8 @@ namespace Edu.WebApi.Controllers.Course
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
query.CreateBy = base.UserInfo.Id;
var q = courseModule.SetImportChapterModule(query);
if (q != null && q.Count > 0)
{
return ApiResult.Success();
}
return ApiResult.Failed();
var flag = courseModule.ImportChapterModule(query);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
......
......@@ -68,6 +68,26 @@ namespace Edu.WebApi.Controllers.Course
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取课程单词列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCourseWordsPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Course_Words_Extend()
{
CourseId = base.ParmJObj.GetInt("CourseId"),
ChapterId = base.ParmJObj.GetInt("ChapterId"),
};
query.Group_Id = base.UserInfo.Group_Id;
var list = courseWordsModule.GetCourseWordsPageModule(pageModel.PageIndex,pageModel.PageSize,out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取课程单词列表
/// </summary>
......
......@@ -243,11 +243,10 @@ namespace Edu.WebApi.Controllers.User
if (model.IsTenCccUser == 1)
{
var tObj = new TenCloudCCCHelper().GetTenCccUserToken(model.Email).Result;
JObject jsobj = JObject.Parse(tObj.ToString());
obj.TenCccToken = new TenCccTokenItem()
{
SdkURL=jsobj.GetStringValue("SdkURL"),
Token=jsobj.GetStringValue("Token")
SdkURL = tObj.SdkURL,
Token = tObj.Token
};
}
UserReidsCache.UserInfoSet(Cache.CacheKey.User_Login_Key + model.Id, obj, Common.Config.JwtExpirTime);
......
......@@ -54,17 +54,22 @@ namespace Edu.WebApi.Filter
if (allowRepeat == null)
{
//需进行表单重复提交验证
string cachedKey = SecurityHelper.MD5(string.Format("cmd={0}&token={1}", controllerName + "/" + actionName, token));
string actionUrl = controllerName + "/" + actionName;
string cachedKey = SecurityHelper.MD5(string.Format("cmd={0}&token={1}", actionUrl, token));
try
{
if (UserReidsCache.Exists(cachedKey))//判断表单是否重复提交
{
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult
if (actionUrl != "course/setchapter")
{
Code = (int)ResultCode.FormRepeatSubmit,
Message = "表单重复提交,请稍后再试",
Data = null
});
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult
{
Code = (int)ResultCode.FormRepeatSubmit,
Message = "表单重复提交,请稍后再试",
Data = null
});
}
}
else
{
......
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