|
|
|
@ -299,8 +299,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region 获取课程 |
|
|
|
|
/// <summary> |
|
|
|
@ -388,7 +387,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
course.CourseWareList = new List<Ghre_StudyRecordCourseWare>(); |
|
|
|
|
course.CourseTeacherList = new List<Ghre_StudyRecordCourseTeacher>(); |
|
|
|
|
var courses = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneId == course.CourseSceneId && x.Status == Consts.DIC_COURSE_STATUS.RELEASED).ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < courses.Count; i++) |
|
|
|
|
{ |
|
|
|
|
var course1 = courses[i]; |
|
|
|
@ -450,5 +449,35 @@ namespace Tiobon.Core.Services |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取ESS查询条件 |
|
|
|
|
public async Task<ServiceResult> Join(long courseId) |
|
|
|
|
{ |
|
|
|
|
var staffId = GetStaffId(); |
|
|
|
|
if (!await base.AnyAsync(x => x.CourseId == courseId && x.StaffId == staffId)) |
|
|
|
|
{ |
|
|
|
|
var course = await Db.Queryable<Ghre_Course>().Where(x => x.Id == courseId && x.Status == Consts.DIC_COURSE_STATUS.RELEASED).FirstAsync(); |
|
|
|
|
if (course.IsNull()) |
|
|
|
|
return ServiceResult.OprateFailed("无效的课程!"); |
|
|
|
|
|
|
|
|
|
DateTime courseTime = Db.GetDate(); |
|
|
|
|
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == courseId); |
|
|
|
|
await base.Add(new InsertGhre_StudyRecordInput |
|
|
|
|
{ |
|
|
|
|
StaffId = staffId, |
|
|
|
|
CourseSnapId = snap?.Id, |
|
|
|
|
CourseId = courseId, |
|
|
|
|
JoinTime = courseTime, |
|
|
|
|
CourseBeginTime = courseTime.Date, |
|
|
|
|
CourseEndTime = courseTime.Date.AddMonths(snap?.ValidityPeriod ?? 1), |
|
|
|
|
CourseType = "Elective", |
|
|
|
|
CourseStatus = Consts.DIC_STUDY_RECORD_COURSE_STATUS_IN, |
|
|
|
|
StudyStatus = Consts.DIC_STUDY_RECORD_STUDY_STATUS_NO_JOIN |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return ServiceResult.OprateSuccess("加入成功!"); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
} |
|
|
|
|
} |