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; }
}
}
......@@ -487,76 +487,177 @@ namespace Edu.Module.Course
}
/// <summary>
/// 导入课程章节到新课程
/// 批量导入课程章节和单词
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<ChapterTree_ViewModel> SetImportChapterModule(RB_Course_Chapter_ViewModel query)
public virtual bool ImportChapterModule(RB_Course_Chapter_ViewModel query)
{
var result = GetChapterTreeListModule(query);
int maxLength = query.MaxLength;
bool flag = false;
var courseWordsList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
Group_Id = query.Group_Id,
QCourseIds = query.CourseIds
});
List<RB_Course_Words_Extend> wordsList = new List<RB_Course_Words_Extend>();
List<RB_Course_Chapter_ViewModel> list = new List<RB_Course_Chapter_ViewModel>();
var treeList = GetChapterTreeListModule(query);
var oldTreeList = GetChapterTreeListModule(new RB_Course_Chapter_ViewModel()
{
Group_Id=query.Group_Id,
CourseId=query.NewCourseId
});
var oldChapterNo = oldTreeList?.LastOrDefault()?.ChapterNo ?? "0";
Int32.TryParse(oldChapterNo, out int oldChapterNum);
int maxLength = oldChapterNum > 0 ? oldChapterNum : query.MaxLength;
string[] ids = query.CourseIds.Split(',', System.StringSplitOptions.RemoveEmptyEntries);
DateTime startTime = DateTime.Now;
foreach (var item in ids)
{
var temp = result.Where(x => x.CourseId.ToString().Equals(item)).ToList();
var array = new List<ChapterTree_ViewModel>();
temp.ForEach(x =>
var tempList = treeList.Where(x => x.CourseId.ToString().Equals(item)).ToList();
var tempWordsList = courseWordsList.Where(qitem => qitem.CourseId.ToString().Equals(item))?.OrderBy(qitem => qitem.ChapterId)?.ToList();
foreach (var subItem in tempList)
{
maxLength++;
x.ChapterNo = maxLength.ToString();
x.ChapterName = FormatNum(x.ChapterName, maxLength);
int pid = GenernalNewChapterNode(x, query);
x.ChapterId = pid;
x.ChildList = x.ChildList != null && x.ChildList.Count > 0 ? ReChangeChapterNo(x.ChildList, maxLength, pid, query) : new List<ChapterTree_ViewModel>();
if (subItem.ParentId == 0)
{
subItem.WordsList = courseWordsList?.Where(qitem => qitem.CourseId == subItem.CourseId && qitem.ChapterId.ToString().Equals(subItem.ChapterNo))?.ToList();
if (subItem.ParentId == 0 && subItem.WordsList != null)
{
foreach (var sItem in subItem.WordsList)
{
Int32.TryParse(subItem.ChapterNo, out int ChapterId);
wordsList.Add(new RB_Course_Words_Extend()
{
Id = 0,
CourseId = query.NewCourseId,
ChapterId = ChapterId,
WordType = sItem.WordType,
WordContent = sItem.WordContent,
WordTone = sItem.WordTone,
WordWrite = sItem.WordWrite,
ChineseMean = sItem.ChineseMean,
FileUrl = sItem.FileUrl,
Status = sItem.Status,
Group_Id = sItem.Group_Id,
CreateBy = query.CreateBy,
UpdateBy = query.CreateBy,
UpdateTime = DateTime.Now,
CreateTime = startTime,
});
}
}
}
var parentModel = new RB_Course_Chapter_ViewModel()
{
ChapterId = 0,
CourseId = query.NewCourseId,
ChapterNo = maxLength.ToString(),
ChapterName = FormatNum(subItem.ChapterName, maxLength),
ChapterContent = subItem.ChapterContent,
ParentId = 0,
OpenStatus = 1,
Progress = 0,
CreateBy = query.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = query.CreateBy,
UpdateTime = DateTime.Now,
Status = DateStateEnum.Normal,
School_Id = query.School_Id,
Group_Id = query.Group_Id,
SortNum = maxLength,
StudyHours = subItem.StudyHours,
StudyMinutes = subItem.StudyMinutes,
Objectives = subItem.Objectives,
Requirement = subItem.Requirement,
CourseRate = subItem.CourseRate,
CurrentHours = subItem.CurrentHours,
};
//父节点
list.Add(parentModel);
});
if (subItem.ChildList != null && subItem.ChildList.Count > 0)
{
TraverseChildChapter(subItem.ChildList,parentModel.ChapterNo, maxLength,subItem.ChapterId, query, ref list);
}
}
}
SetBatchAllChapterCurrentHoursModule(query.NewCourseId);
return result;
}
public List<ChapterTree_ViewModel> ReChangeChapterNo(List<ChapterTree_ViewModel> list, int parentNo, int parentId, RB_Course_Chapter_ViewModel query)
{
list.ForEach(x =>
if (list != null && list.Count > 0)
{
var oldNo = x.ChapterNo.Split('.');
oldNo[0] = parentNo.ToString();
x.ChapterNo = string.Join(".", oldNo);
//x.ChapterName = FormatNum(x.ChapterName, parentNo);
x.ParentId = parentId;
int pid = GenernalNewChapterNode(x, query);
x.ChapterId = pid;
x.ChildList = ReChangeChapterNo(x.ChildList, parentNo, pid, query);
flag = chapterRepository.SetBatchInsertCourseChapterRepository(list);
}
var dataList = chapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel()
{
CourseId = query.NewCourseId,
QCreateTime = Common.ConvertHelper.FormatTime(startTime)
});
return list;
List<RB_Course_Chapter_ViewModel> parentList = new List<RB_Course_Chapter_ViewModel>();
foreach (var item in dataList.Where(qitem=>qitem.ParentId>0))
{
var tempModel = dataList.Where(qitem => qitem.ChapterNo == item.ParentId.ToString())?.FirstOrDefault();
item.ParentId = tempModel?.ChapterId ?? 0;
parentList.Add(item);
}
if (wordsList != null && wordsList.Count > 0)
{
course_WordsRepository.BatchInsertCourseWordsRepository(wordsList);
}
chapterRepository.SetBatchUpdateChapterNoRepository(parentList);
SetBatchAllChapterCurrentHoursModule(query.NewCourseId);
return flag;
}
public int GenernalNewChapterNode(ChapterTree_ViewModel model, RB_Course_Chapter_ViewModel query)
/// <summary>
/// 遍历子节点
/// </summary>
/// <param name="nodeList"></param>
/// <param name="parentId"></param>
public void TraverseChildChapter(List<ChapterTree_ViewModel> sourceList,string ChapterNo,int Num, int parentId, RB_Course_Chapter_ViewModel query, ref List<RB_Course_Chapter_ViewModel> list)
{
RB_Course_Chapter_ViewModel newModel = new RB_Course_Chapter_ViewModel()
if (sourceList != null)
{
ChapterContent = model.ChapterContent,
ChapterId = 0,
ChapterName = model.ChapterName,
ChapterNo = model.ChapterNo,
CourseId = query.NewCourseId,
CourseRate = model.CourseRate,
CreateBy = query.CreateBy,
CreateTime = DateTime.Now,
CurrentHours = model.CurrentHours,
Group_Id = query.Group_Id,
Objectives = model.Objectives,
OpenStatus = model.OpenStatus,
ParentId = model.ParentId,
Requirement = model.Requirement,
School_Id = query.School_Id,
Status = DateStateEnum.Normal,
StudyHours = model.StudyHours,
StudyMinutes = model.StudyMinutes
};
SetChapterModule(newModel);
return newModel.ChapterId;
int subIndex = 0;
foreach (var subItem in sourceList.Where(qitem => qitem.ParentId == parentId))
{
subIndex++;
var oldNo = subItem.ChapterNo.Split('.');
oldNo[0] = ChapterNo;
string newChapterNo = string.Join(".", oldNo);
var model = new RB_Course_Chapter_ViewModel()
{
ChapterId = 0,
CourseId = query.NewCourseId,
ChapterNo = newChapterNo,
ChapterName = subItem.ChapterName,
ChapterContent = subItem.ChapterContent,
ParentId = Num,
OpenStatus = 1,
Progress = 0,
CreateBy = query.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = query.CreateBy,
UpdateTime = DateTime.Now,
Status = DateStateEnum.Normal,
School_Id = query.School_Id,
Group_Id = query.Group_Id,
SortNum = 0,
StudyHours = subItem.StudyHours,
StudyMinutes = subItem.StudyMinutes,
Objectives = subItem.Objectives,
Requirement = subItem.Requirement,
CourseRate = subItem.CourseRate,
CurrentHours = subItem.CurrentHours,
};
list.Add(model);
if (subItem.ChildList != null && subItem.ChildList.Count > 0)
{
TraverseChildChapter(subItem.ChildList,subItem.ChapterNo, subIndex, subItem.ChapterId, query, ref list);
}
}
}
}
/// <summary>
......@@ -585,7 +686,8 @@ namespace Edu.Module.Course
var list = GetChapterListModule(query);
list.ForEach(x =>
{
x.SerialNumber = int.Parse(x.ChapterNo.Replace(".", ""));
Int32.TryParse(x.ChapterNo.Replace(".", ""), out int ChapterNo);
x.SerialNumber = ChapterNo;
});
List<ChapterTree_ViewModel> treeList = GetChapterChild(list, 0);
return treeList;
......@@ -727,7 +829,11 @@ namespace Edu.Module.Course
}
}
});
return chapterRepository.SetBatchCurrentHoursRepository(list);
if (list != null && list.Count > 0)
{
return chapterRepository.SetBatchCurrentHoursRepository(list);
}
return false;
}
/// <summary>
......
......@@ -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