Commit 58430441 authored by 黄奎's avatar 黄奎

课程导入增加单词导入,并替换成批量导入课程

parent 9e75dc21
...@@ -86,6 +86,11 @@ namespace Edu.Model.ViewModel.Course ...@@ -86,6 +86,11 @@ namespace Edu.Model.ViewModel.Course
/// 当前课时(累加计算) /// 当前课时(累加计算)
/// </summary> /// </summary>
public double CurrentHours { get; set; } 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 ...@@ -33,5 +33,10 @@ namespace Edu.Model.ViewModel.Course
/// </summary> /// </summary>
public string CourseName { get; set; } public string CourseName { get; set; }
/// <summary>
/// 创建时间查询
/// </summary>
public string QCreateTime { get; set; }
} }
} }
...@@ -487,76 +487,178 @@ namespace Edu.Module.Course ...@@ -487,76 +487,178 @@ namespace Edu.Module.Course
} }
/// <summary> /// <summary>
/// 导入课程章节到新课程 /// 批量导入课程章节和单词
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <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); bool flag = false;
int maxLength = query.MaxLength; 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); string[] ids = query.CourseIds.Split(',', System.StringSplitOptions.RemoveEmptyEntries);
DateTime startTime = DateTime.Now;
foreach (var item in ids) foreach (var item in ids)
{ {
var temp = result.Where(x => x.CourseId.ToString().Equals(item)).ToList(); var tempList = treeList.Where(x => x.CourseId.ToString().Equals(item)).ToList();
var array = new List<ChapterTree_ViewModel>(); var tempWordsList = courseWordsList.Where(qitem => qitem.CourseId.ToString().Equals(item))?.OrderBy(qitem => qitem.ChapterId)?.ToList();
temp.ForEach(x => foreach (var subItem in tempList)
{ {
maxLength++; maxLength++;
x.ChapterNo = maxLength.ToString(); if (subItem.ParentId == 0)
x.ChapterName = FormatNum(x.ChapterName, maxLength); {
int pid = GenernalNewChapterNode(x, query); subItem.WordsList = courseWordsList?.Where(qitem => qitem.CourseId == subItem.CourseId && qitem.ChapterId.ToString().Equals(subItem.ChapterNo))?.ToList();
x.ChapterId = pid; if (subItem.ParentId == 0 && subItem.WordsList != null)
x.ChildList = x.ChildList != null && x.ChildList.Count > 0 ? ReChangeChapterNo(x.ChildList, maxLength, pid, query) : new List<ChapterTree_ViewModel>(); {
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); if (list != null && list.Count > 0)
return result;
}
public List<ChapterTree_ViewModel> ReChangeChapterNo(List<ChapterTree_ViewModel> list, int parentNo, int parentId, RB_Course_Chapter_ViewModel query)
{
list.ForEach(x =>
{ {
var oldNo = x.ChapterNo.Split('.'); flag = chapterRepository.SetBatchInsertCourseChapterRepository(list);
oldNo[0] = parentNo.ToString(); }
x.ChapterNo = string.Join(".", oldNo); var dataList = chapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel()
//x.ChapterName = FormatNum(x.ChapterName, parentNo); {
x.ParentId = parentId; CourseId = query.NewCourseId,
int pid = GenernalNewChapterNode(x, query); QCreateTime = Common.ConvertHelper.FormatTime(startTime)
x.ChapterId = pid;
x.ChildList = ReChangeChapterNo(x.ChildList, parentNo, pid, query);
}); });
List<RB_Course_Chapter_ViewModel> parentList = new List<RB_Course_Chapter_ViewModel>();
return list; 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, int subIndex = 0;
ChapterId = 0, foreach (var subItem in sourceList.Where(qitem => qitem.ParentId == parentId))
ChapterName = model.ChapterName, {
ChapterNo = model.ChapterNo, subIndex++;
CourseId = query.NewCourseId,
CourseRate = model.CourseRate, var oldNo = subItem.ChapterNo.Split('.');
CreateBy = query.CreateBy, oldNo[0] = ChapterNo;
CreateTime = DateTime.Now, string newChapterNo = string.Join(".", oldNo);
CurrentHours = model.CurrentHours, var model = new RB_Course_Chapter_ViewModel()
Group_Id = query.Group_Id, {
Objectives = model.Objectives, ChapterId = 0,
OpenStatus = model.OpenStatus, CourseId = query.NewCourseId,
ParentId = model.ParentId, ChapterNo = newChapterNo,
Requirement = model.Requirement, ChapterName = subItem.ChapterName,
School_Id = query.School_Id, ChapterContent = subItem.ChapterContent,
Status = DateStateEnum.Normal, ParentId = Num,
StudyHours = model.StudyHours, OpenStatus = 1,
StudyMinutes = model.StudyMinutes Progress = 0,
}; CreateBy = query.CreateBy,
SetChapterModule(newModel); CreateTime = DateTime.Now,
return newModel.ChapterId; 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> /// <summary>
...@@ -585,7 +687,8 @@ namespace Edu.Module.Course ...@@ -585,7 +687,8 @@ namespace Edu.Module.Course
var list = GetChapterListModule(query); var list = GetChapterListModule(query);
list.ForEach(x => 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); List<ChapterTree_ViewModel> treeList = GetChapterChild(list, 0);
return treeList; return treeList;
...@@ -727,7 +830,11 @@ namespace Edu.Module.Course ...@@ -727,7 +830,11 @@ namespace Edu.Module.Course
} }
} }
}); });
return chapterRepository.SetBatchCurrentHoursRepository(list); if (list != null && list.Count > 0)
{
return chapterRepository.SetBatchCurrentHoursRepository(list);
}
return false;
} }
/// <summary> /// <summary>
......
...@@ -23,11 +23,7 @@ namespace Edu.Repository.Course ...@@ -23,11 +23,7 @@ namespace Edu.Repository.Course
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
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.Status), EnumHelper.ToInt(DateStateEnum.Normal));
if (query != null) if (query != null)
{ {
...@@ -43,11 +39,33 @@ namespace Edu.Repository.Course ...@@ -43,11 +39,33 @@ namespace Edu.Repository.Course
{ {
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Course_Chapter_ViewModel.CourseId), query.CourseIds); 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(); 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>
/// 批量更新编号 /// 批量更新编号
/// </summary> /// </summary>
...@@ -68,6 +86,11 @@ namespace Edu.Repository.Course ...@@ -68,6 +86,11 @@ namespace Edu.Repository.Course
return Execute(builder.ToString()) > 0; return Execute(builder.ToString()) > 0;
} }
/// <summary>
/// 批量插入当前课时
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public bool SetBatchCurrentHoursRepository(List<RB_Course_Chapter_ViewModel> param) public bool SetBatchCurrentHoursRepository(List<RB_Course_Chapter_ViewModel> param)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
...@@ -93,7 +116,6 @@ namespace Edu.Repository.Course ...@@ -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("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(" 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); builder.AppendFormat(" and {0} like '{1}%'", nameof(RB_Course_Chapter_ViewModel.ChapterNo), model.ChapterNo);
return Execute(builder.ToString()) > 0; return Execute(builder.ToString()) > 0;
} }
...@@ -109,7 +131,6 @@ namespace Edu.Repository.Course ...@@ -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("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(" 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); 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; return Execute(builder.ToString()) > 0;
} }
...@@ -123,15 +144,10 @@ namespace Edu.Repository.Course ...@@ -123,15 +144,10 @@ namespace Edu.Repository.Course
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
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.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId); 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(" 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(); return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
} }
...@@ -146,11 +162,7 @@ namespace Edu.Repository.Course ...@@ -146,11 +162,7 @@ namespace Edu.Repository.Course
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@" SELECT * FROM rb_course_chapter WHERE 1=1 ");
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.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId); builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId);
if (!string.IsNullOrWhiteSpace(currentHours)) if (!string.IsNullOrWhiteSpace(currentHours))
...@@ -167,15 +179,9 @@ namespace Edu.Repository.Course ...@@ -167,15 +179,9 @@ namespace Edu.Repository.Course
builder.AppendFormat(" Or "); builder.AppendFormat(" Or ");
} }
} }
builder.AppendFormat(" )"); builder.AppendFormat(" )");
} }
//builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours));
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList(); return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
} }
} }
} }
\ No newline at end of file
using Edu.Model.ViewModel.User; using Edu.Model.CacheModel;
using Edu.Model.ViewModel.User;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -111,18 +112,17 @@ namespace Edu.ThirdCore.TenCloud ...@@ -111,18 +112,17 @@ namespace Edu.ThirdCore.TenCloud
/// 获取电话客服的Token /// 获取电话客服的Token
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<object> GetTenCccUserToken(string mail) public async Task<TenCccTokenItem> GetTenCccUserToken(string mail)
{ {
var credential = TenCloudCredential._instance; var credential = TenCloudCredential._instance;
var tenCccTokenItem = new TenCccTokenItem();
CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest(); CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest();
req.SdkAppId = SDKAPPID; req.SdkAppId = SDKAPPID;
req.SeatUserId = mail; req.SeatUserId = mail;
CreateSDKLoginTokenResponse resp = credential.CreateSDKLoginTokenSync(req); CreateSDKLoginTokenResponse resp = credential.CreateSDKLoginTokenSync(req);
return new tenCccTokenItem.SdkURL = resp.SdkURL;
{ tenCccTokenItem.Token = resp.Token;
SdkURL = resp.SdkURL, return tenCccTokenItem;
Token = resp.Token
};
} }
} }
......
...@@ -1731,12 +1731,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1731,12 +1731,8 @@ namespace Edu.WebApi.Controllers.Course
itemDetails.DurationEndTime = startTime.AddMinutes(tempDuration).ToString("HH:mm"); itemDetails.DurationEndTime = startTime.AddMinutes(tempDuration).ToString("HH:mm");
} }
} }
item.LessonPlanProjectsList = projectList.Where(x => x.LessonPlanId == item.LessonPlanId).ToList(); 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(); model.IsEditSummary += item.LessonPlanDetailsList.Where(x => !string.IsNullOrWhiteSpace(x.Summary)).Count();
} }
} }
} }
...@@ -1745,19 +1741,15 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1745,19 +1741,15 @@ namespace Edu.WebApi.Controllers.Course
model.LessonPlanList = new List<RB_Class_LessonPlan_ViewModel> 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>() },
//new RB_Class_LessonPlan_ViewModel { CourseName = "理解篇", LessonPlanDetailsList = new List<RB_Class_LessonPlanDetails_ViewModel>(), LessonPlanProjectsList = new List<RB_Class_LessonPlanProjects_ViewModel>() }
}; };
} }
#region 追加章节信息 #region 追加章节信息
var hours = classModule.GetCurrentPlanStudyHoursRepository(model.ClassPlanId) + 1; var hours = classModule.GetCurrentPlanStudyHoursRepository(model.ClassPlanId) + 1;
if (hours != -1) if (hours != -1)
{ {
var classObj = classModule.GetClassModule(model.ClassId); var classObj = classModule.GetClassModule(model.ClassId);
var courseOjb = new CourseModule().GetCourseModule(classObj.CouseId); var courseOjb = new CourseModule().GetCourseModule(classObj.CouseId);
var chapter = new CourseModule().GetMatchHoursChapterModule(classObj.CouseId, hours); var chapter = new CourseModule().GetMatchHoursChapterModule(classObj.CouseId, hours);
if (chapter != null && chapter.Count > 0) if (chapter != null && chapter.Count > 0)
{ {
...@@ -1765,9 +1757,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1765,9 +1757,7 @@ namespace Edu.WebApi.Controllers.Course
} }
model.CourseName = courseOjb.CourseName; model.CourseName = courseOjb.CourseName;
} }
#endregion #endregion
return ApiResult.Success("", model); return ApiResult.Success("", model);
} }
......
...@@ -583,7 +583,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -583,7 +583,7 @@ namespace Edu.WebApi.Controllers.Course
#region 课程章节管理 #region 课程章节管理
/// <summary> /// <summary>
/// 导入课程章节到新课程 /// 导入课程章节和单词到新课程
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
...@@ -598,12 +598,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -598,12 +598,8 @@ namespace Edu.WebApi.Controllers.Course
query.Group_Id = base.UserInfo.Group_Id; query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id; query.School_Id = base.UserInfo.School_Id;
query.CreateBy = base.UserInfo.Id; query.CreateBy = base.UserInfo.Id;
var q = courseModule.SetImportChapterModule(query); var flag = courseModule.ImportChapterModule(query);
if (q != null && q.Count > 0) return flag ? ApiResult.Success() : ApiResult.Failed();
{
return ApiResult.Success();
}
return ApiResult.Failed();
} }
/// <summary> /// <summary>
......
...@@ -243,11 +243,10 @@ namespace Edu.WebApi.Controllers.User ...@@ -243,11 +243,10 @@ namespace Edu.WebApi.Controllers.User
if (model.IsTenCccUser == 1) if (model.IsTenCccUser == 1)
{ {
var tObj = new TenCloudCCCHelper().GetTenCccUserToken(model.Email).Result; var tObj = new TenCloudCCCHelper().GetTenCccUserToken(model.Email).Result;
JObject jsobj = JObject.Parse(tObj.ToString());
obj.TenCccToken = new TenCccTokenItem() obj.TenCccToken = new TenCccTokenItem()
{ {
SdkURL=jsobj.GetStringValue("SdkURL"), SdkURL = tObj.SdkURL,
Token=jsobj.GetStringValue("Token") Token = tObj.Token
}; };
} }
UserReidsCache.UserInfoSet(Cache.CacheKey.User_Login_Key + model.Id, obj, Common.Config.JwtExpirTime); UserReidsCache.UserInfoSet(Cache.CacheKey.User_Login_Key + model.Id, obj, Common.Config.JwtExpirTime);
......
...@@ -54,17 +54,22 @@ namespace Edu.WebApi.Filter ...@@ -54,17 +54,22 @@ namespace Edu.WebApi.Filter
if (allowRepeat == null) 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 try
{ {
if (UserReidsCache.Exists(cachedKey))//判断表单是否重复提交 if (UserReidsCache.Exists(cachedKey))//判断表单是否重复提交
{ {
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult if (actionUrl != "course/setchapter")
{ {
Code = (int)ResultCode.FormRepeatSubmit, actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult
Message = "表单重复提交,请稍后再试", {
Data = null Code = (int)ResultCode.FormRepeatSubmit,
}); Message = "表单重复提交,请稍后再试",
Data = null
});
}
} }
else 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