Commit 88f0e029 authored by 黄奎's avatar 黄奎

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

parents 90df073e ffcba34f
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Plugin;
namespace Edu.Common.Enum.Course
{
public enum LearningGardenTypeEnum
{
/// <summary>
/// 日语园地
/// </summary>
[EnumField("日语园地")]
Japanese = 1,
/// <summary>
/// 韩语园地
/// </summary>
[EnumField("韩语园地")]
Korean = 2
}
}
...@@ -98,5 +98,10 @@ namespace Edu.Model.Entity.LearningGarden ...@@ -98,5 +98,10 @@ namespace Edu.Model.Entity.LearningGarden
/// 学校编号 /// 学校编号
/// </summary> /// </summary>
public int School_Id { get; set; } public int School_Id { get; set; }
/// <summary>
/// 园地类型 1日语 2韩语 枚举列表
/// </summary>
public Common.Enum.Course.LearningGardenTypeEnum GardenType { get; set; }
} }
} }
...@@ -264,5 +264,25 @@ namespace Edu.Model.ViewModel.User ...@@ -264,5 +264,25 @@ namespace Edu.Model.ViewModel.User
/// 创建人编号 /// 创建人编号
/// </summary> /// </summary>
public List<int> CreateIds { get; set; } public List<int> CreateIds { get; set; }
/// <summary>
/// 课程图标
/// </summary>
public string B2BIcon { get; set; }
/// <summary>
/// 课程背景颜色
/// </summary>
public string B2BBackground { get; set; }
/// <summary>
/// 累计课时
/// </summary>
public decimal TotalHours { get; set; }
/// <summary>
/// 已完成课时
/// </summary>
public decimal CompleteHours { get; set; }
} }
} }
\ No newline at end of file
...@@ -605,7 +605,7 @@ namespace Edu.Module.Course ...@@ -605,7 +605,7 @@ namespace Edu.Module.Course
SetGoodsSpecificationValue(model); SetGoodsSpecificationValue(model);
#endregion #endregion
return flag; return flag;
} }
/// <summary> /// <summary>
/// 添加上课计划 /// 添加上课计划
...@@ -4788,6 +4788,46 @@ namespace Edu.Module.Course ...@@ -4788,6 +4788,46 @@ namespace Edu.Module.Course
return planList; return planList;
} }
/// <summary>
/// 获取最近7天课程回顾
/// </summary>
/// <param name="classId"></param>
/// <param name="day"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public object GetStudyCourseReview(int classId, int day, int group_Id)
{
List<object> RList = new List<object>();
//先获取最近7天上课计划
var planList = class_PlanRepository.GetStudyCourseReview(classId, day, group_Id);
if (planList.Any()) {
//获取上课时间
string planIds = string.Join(",", planList.Select(x => x.ClassPlanId));
var timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = group_Id, QClassPlanIds = planIds });
foreach (var item in planList) {
var tlist = timeList.Where(x => x.ClassPlanId == item.ClassPlanId).ToList();
int Num = 1;
RList.Add(new
{
item.ClassPlanId,
item.ClassDate,
List = tlist.OrderBy(x => x.StartTime).Select(x => new
{
x.ClassTimeId,
Num = Num++,
x.StartTime,
x.EndTime,
x.SuiPai,
x.VideoUrl,
x.InClassTime,
x.ClassOverTime
})
});
}
}
return RList;
}
#endregion #endregion
#region 上课反馈记录 #region 上课反馈记录
......
...@@ -767,7 +767,11 @@ namespace Edu.Module.User ...@@ -767,7 +767,11 @@ namespace Edu.Module.User
public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id) public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id)
{ {
//获取正在学习的课程 //获取正在学习的课程
return student_OrderGuestRepository.GetLearningCourseInfo(accountId, group_Id); var model = student_OrderGuestRepository.GetLearningCourseInfo(accountId, group_Id, 1);
if (model == null) {
model = student_OrderGuestRepository.GetLearningCourseInfo(accountId, group_Id, 2);
}
return model;
} }
#endregion #endregion
......
...@@ -1163,5 +1163,33 @@ group by TeacherId"; ...@@ -1163,5 +1163,33 @@ group by TeacherId";
return Get<RB_Class_Plan_ViewModel>(sql,null).ToList(); return Get<RB_Class_Plan_ViewModel>(sql,null).ToList();
} }
/// <summary>
/// 获取最近7天上课计划
/// </summary>
/// <param name="classId"></param>
/// <param name="day"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetStudyCourseReview(int classId, int day, int group_Id)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT a.*
FROM rb_class_plan as a
WHERE a.`Status`=0 ");
if (group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.Group_Id), group_Id);
}
if (classId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.ClassId), classId);
}
builder.AppendFormat(@$" And a.ClassDate <='{DateTime.Now.ToString("yyyy-MM-dd")} 23:59:59'");
builder.AppendFormat(@" ORDER BY ClassDate DESC limit " + day);
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
} }
} }
...@@ -41,12 +41,15 @@ WHERE 1=1 ...@@ -41,12 +41,15 @@ WHERE 1=1
{ {
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Group_Id), query.Group_Id); builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Group_Id), query.Group_Id);
} }
if (query.GardenType > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.GardenType), (int)query.GardenType);
}
if (!string.IsNullOrEmpty(query.Title)) if (!string.IsNullOrEmpty(query.Title))
{ {
builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_LearningGarden_ViewModel.Title)); builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_LearningGarden_ViewModel.Title));
parameters.Add("Title", "%" + query.Title.Trim() + "%"); parameters.Add("Title", "%" + query.Title.Trim() + "%");
} }
} }
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_LearningGarden_ViewModel.Id)); builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_LearningGarden_ViewModel.Id));
return GetPage<RB_LearningGarden_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList(); return GetPage<RB_LearningGarden_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
......
...@@ -336,7 +336,7 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={ ...@@ -336,7 +336,7 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat($@" builder.AppendFormat($@"
SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID, if((og.ValidClassHours-og.CompleteHours)<0,0,(og.ValidClassHours-og.CompleteHours)) as SurplusHours SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,cou.B2BIcon,cou.B2BBackground,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,og.TotalHours,og.CompleteHours, if((og.ValidClassHours-og.CompleteHours)<0,0,(og.ValidClassHours-og.CompleteHours)) as SurplusHours
FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_order as o on og.OrderId=o.OrderId LEFT JOIN rb_order as o on og.OrderId=o.OrderId
...@@ -344,7 +344,7 @@ FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Stude ...@@ -344,7 +344,7 @@ FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Stude
LEFT JOIN rb_class as c on c.ClassId=o.ClassId LEFT JOIN rb_class as c on c.ClassId=o.ClassId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}"); WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState <>2 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");
return Get<RB_Student_ViewModel>(builder.ToString(), parameters).ToList(); return Get<RB_Student_ViewModel>(builder.ToString(), parameters).ToList();
} }
......
...@@ -196,7 +196,7 @@ where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderTy ...@@ -196,7 +196,7 @@ where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderTy
inner join rb_order o on og.OrderId = o.OrderId inner join rb_order o on og.OrderId = o.OrderId
where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =2 and og.Student_Id ={accountId}) as StudyAbroadNum,"; where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =2 and og.Student_Id ={accountId}) as StudyAbroadNum,";
sql += $@"(select count(0) from RB_Student_OrderGuest og sql += $@"(select count(0) from RB_Student_OrderGuest og
inner join rb_education_contract ec on ec.GuestId = o.GuestId inner join rb_education_contract ec on ec.GuestId = og.GuestId
inner join rb_order o on og.OrderId = o.OrderId inner join rb_order o on og.OrderId = o.OrderId
where og.Status =0 and ec.Group_Id ={group_Id} and ec.Status <>4 and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId}) as ContractNum"; where og.Status =0 and ec.Group_Id ={group_Id} and ec.Status <>4 and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId}) as ContractNum";
...@@ -209,14 +209,14 @@ where og.Status =0 and ec.Group_Id ={group_Id} and ec.Status <>4 and o.OrderStat ...@@ -209,14 +209,14 @@ where og.Status =0 and ec.Group_Id ={group_Id} and ec.Status <>4 and o.OrderStat
/// <param name="accountId"></param> /// <param name="accountId"></param>
/// <param name="group_Id"></param> /// <param name="group_Id"></param>
/// <returns></returns> /// <returns></returns>
public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id) public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id, int Type)
{ {
string sql = $@"SELECT og.*,o.CourseId FROM rb_student_orderguest og string sql = $@"SELECT og.*,o.CourseId,c.ClassStatus,c.ClassName FROM rb_student_orderguest og
INNER JOIN rb_order_guest g on og.GuestId = g.Id INNER JOIN rb_order_guest g on og.GuestId = g.Id
INNER JOIN rb_order o on og.OrderId = o.OrderId INNER JOIN rb_order o on og.OrderId = o.OrderId
INNER JOIN rb_class c on o.ClassId = c.ClassId INNER JOIN rb_class c on o.ClassId = c.ClassId
WHERE og.Status =0 and g.`Status` =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId} WHERE og.Status =0 and g.`Status` =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId} and {(Type==1? "c.ClassStatus =2" : "c.ClassStatus <>2")}
ORDER BY c.OpenTime ASC LIMIT 1"; ORDER BY {(Type == 1 ? "c.OpenTime asc" : "c.OpenTime desc")} LIMIT 1";
return Get<RB_Student_OrderGuest_ViewModel>(sql).FirstOrDefault(); return Get<RB_Student_OrderGuest_ViewModel>(sql).FirstOrDefault();
} }
} }
......
...@@ -98,11 +98,18 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -98,11 +98,18 @@ namespace Edu.WebApi.Controllers.Applet
CourseInfo = new CourseInfo = new
{ {
State = 1, State = 1,
TotalHours = guestModel?.TotalHours??0, TotalHours = guestModel?.TotalHours ?? 0,
CompleteHours = guestModel?.CompleteHours??0, CompleteHours = guestModel?.CompleteHours ?? 0,
AbsenceNum = guestModel?.AbsenceNum??0, AbsenceNum = guestModel?.AbsenceNum ?? 0,
LeaveNum = guestModel?.LeaveNum??0, LeaveNum = guestModel?.LeaveNum ?? 0,
CourseId = courseModel?.CourseId ?? 0,
CourseName = courseModel?.CourseName ?? "",
CourseRate = courseModel?.CourseRate.ToName() ?? "",
B2BIcon = courseModel?.B2BIcon ?? "",
B2BBackground = courseModel?.B2BBackground ?? "",
LearningInfo.ClassStatus,
ClassStatusName = LearningInfo.ClassStatus.ToName(),
LearningInfo.ClassName
}; };
} }
else { else {
...@@ -125,7 +132,8 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -125,7 +132,8 @@ namespace Edu.WebApi.Controllers.Applet
orderModel.OrderNum, orderModel.OrderNum,
orderModel.StudyAbroadNum, orderModel.StudyAbroadNum,
orderModel.ContractNum, orderModel.ContractNum,
AssistList = assistList AssistList = RAssistList,
CourseInfo
}); });
} }
......
...@@ -34,7 +34,6 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -34,7 +34,6 @@ namespace Edu.WebApi.Controllers.Applet
/// 学生管理处理类 /// 学生管理处理类
/// </summary> /// </summary>
private readonly StudentModule studentModule = new StudentModule(); private readonly StudentModule studentModule = new StudentModule();
/// <summary> /// <summary>
/// 学生管理处理类 /// 学生管理处理类
/// </summary> /// </summary>
...@@ -47,23 +46,20 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -47,23 +46,20 @@ namespace Edu.WebApi.Controllers.Applet
/// 课程处理类对象 /// 课程处理类对象
/// </summary> /// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>(); private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary> /// <summary>
/// 教务单据处理类对象 /// 教务单据处理类对象
/// </summary> /// </summary>
private readonly EducationReceiptModule educationReceiptModule = AOP.AOPHelper.CreateAOPObject<EducationReceiptModule>(); private readonly EducationReceiptModule educationReceiptModule = AOP.AOPHelper.CreateAOPObject<EducationReceiptModule>();
/// <summary> /// <summary>
/// 试卷处理类对象 /// 试卷处理类对象
/// </summary> /// </summary>
private readonly Module.Exam.PaperModule paperModule = AOP.AOPHelper.CreateAOPObject<Module.Exam.PaperModule>(); private readonly Module.Exam.PaperModule paperModule = AOP.AOPHelper.CreateAOPObject<Module.Exam.PaperModule>();
/// <summary> /// <summary>
/// 学习园地处理类对象 /// 学习园地处理类对象
/// </summary> /// </summary>
private readonly LearningGardenModule learningGardenModule = AOP.AOPHelper.CreateAOPObject<LearningGardenModule>(); private readonly LearningGardenModule learningGardenModule = AOP.AOPHelper.CreateAOPObject<LearningGardenModule>();
#region 小程序首页 #region 小程序首页
/// <summary> /// <summary>
/// 小程序首页 /// 小程序首页
...@@ -177,6 +173,9 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -177,6 +173,9 @@ namespace Edu.WebApi.Controllers.Applet
TimeStart = classModel.StartTime, TimeStart = classModel.StartTime,
classModel.TeacherName, classModel.TeacherName,
TimeStatusStr = classModel.ClassStatus, TimeStatusStr = classModel.ClassStatus,
classModel.RoomName,
classModel.CourseName,
classModel.ClassName
}, },
paperList = examinationPublishList.Select(x => new paperList = examinationPublishList.Select(x => new
{ {
...@@ -194,8 +193,217 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -194,8 +193,217 @@ namespace Edu.WebApi.Controllers.Applet
return ApiResult.Success("", result); return ApiResult.Success("", result);
} }
/// <summary>
/// 获取小程序首页信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetIndexInfo_V2() {
var appletUserInfo = base.AppletUserInfo;
//判断学员是否退学
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
if (studentList == null || !studentList.Any())
{
return ApiResult.Failed(message: $"很抱歉,由于你已经退学,无法继续使用本系统", new { Error = 3 });
}
//获取正在学习的班级 /未开班/已结班
RB_Student_ViewModel studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 2).FirstOrDefault();
if (studentModel == null || studentModel.StuId == 0)
{
studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 1).FirstOrDefault();
if (studentModel == null || studentModel.StuId == 0)
{
studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 3).FirstOrDefault();
}
}
//查询下一节课(要查询正在学习中)
var ClassNext = new object();
if (studentModel.ClassStatus != 3) {
var classTimeList = classModule.GetClassTimeByClassId(studentModel.ClassId, appletUserInfo.Group_Id);
int ClassPlanState = 1;//上课中
var tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.ClassId == studentModel.ClassId && x.NewPlanDateTime.HasValue && System.DateTime.Now >= x.NewPlanDateTime.Value && x.NewEndPlanDateTime.HasValue && System.DateTime.Now < x.NewEndPlanDateTime.Value);
if (tempList == null || !tempList.Any())
{
tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.ClassId == studentModel.ClassId && x.NewPlanDateTime.HasValue && System.DateTime.Now <= x.NewPlanDateTime.Value);
ClassPlanState = 2;//待上课
}
var classModel = tempList?.OrderBy(x => x.NewPlanDateTime).FirstOrDefault();
if (classModel == null || classModel.ClassTimeId == 0)
{
classModel = new Model.ViewModel.Grade.RB_Class_Time_Extend();
ClassPlanState = 3;//暂无
}
ClassNext = new //我的课表最新一个数据
{
ClassPlanState,// 1上课中 2下一课 3暂无
DateStr = (classModel.NewPlanDateTime.HasValue) ? classModel?.NewPlanDateTime.Value.ToString("yyyy-MM-dd") : "",
DateStart = classModel.StartTime,
TimeStr = (classModel.NewPlanDateTime.HasValue) ? Common.ConvertHelper.GetTimeStr(classModel.NewPlanDateTime.Value) : "",
classModel.TeacherName,
classModel.RoomName,
classModel.CourseName,
classModel.ClassName
};
}
else {
ClassNext = new
{
ClassPlanState = 3//暂无下一节课
};
}
//查询学习园地
var LearningGardenList = new List<object>();
var enumlist = EnumHelper.EnumToList(typeof(Common.Enum.Course.LearningGardenTypeEnum));
foreach (var item in enumlist) {
var query = new RB_LearningGarden_ViewModel()
{
Group_Id = base.AppletUserInfo.Group_Id,
GardenType = (Common.Enum.Course.LearningGardenTypeEnum)item.Id,
Status = DateStateEnum.Normal
};
var list = learningGardenModule.GetLearningGardenPageModule(1, 3, out long rowsCount, query);
List<object> resultList = new List<object>();
foreach (var qitem in list)
{
string CreateByName = "甲鹤教育";
if (qitem.CreateBy > 0)
{
CreateByName = UserReidsCache.GetUserLoginInfo(qitem.CreateBy)?.AccountName ?? "";
}
resultList.Add(new
{
qitem.Id,
qitem.Title,
qitem.Content,
qitem.Img,
qitem.Digest,
qitem.LinkUrl,
CreateByName,
qitem.TypeId,
CreateTime = StringHelper.DateFormatToString(qitem.CreateDate)
});
}
LearningGardenList.Add(new
{
item.Id,
item.Name,
List = resultList
});
}
//查询单词
return ApiResult.Success("", new {
studentModel.GuestId,
studentModel.SName,//学区
studentModel.SurplusHours,//剩余课时
studentModel.TeacherName,//老师
studentModel.ClassId,
studentModel.ClassName,//班级
studentModel.CourseId,
studentModel.CourseName,//课程
ClassNext,
LearningGardenList
});
}
/// <summary>
/// 获取学生学习的课程
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStudyCourse() {
var appletUserInfo = base.AppletUserInfo;
//判断学员是否退学
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
if (studentList == null || !studentList.Any())
{
return ApiResult.Failed(message: $"很抱歉,由于你已经退学,无法继续使用本系统", new { Error = 3 });
}
RB_Student_ViewModel studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 2).FirstOrDefault();
if (studentModel == null || studentModel.StuId == 0)
{
studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 1).FirstOrDefault();
if (studentModel == null || studentModel.StuId == 0)
{
studentModel = new RB_Student_ViewModel();
studentModel = studentList.Where(x => x.ClassStatus == 3).FirstOrDefault();
}
}
var result = new
{
studentModel.GuestId,
studentModel.SName,//学区
studentModel.SurplusHours,//剩余时间
studentModel.TeacherName,//老师
studentModel.ClassId,
studentModel.ClassName,
studentModel.CourseId,
studentModel.CourseName,//课程
};
return ApiResult.Success("", result);
}
#endregion #endregion
#region 我的学习
/// <summary>
/// 获取我的学习课程列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyStudyCourseList() {
var appletUserInfo = base.AppletUserInfo;
//获取学生所有的课程
var studentList = studentModule.GetStudentInfo(appletUserInfo.AccountId, appletUserInfo.Group_Id);
studentList = studentList.OrderByDescending(x => x.ClassStatus).ToList();
return ApiResult.Success("", studentList.Select(x => new
{
x.StuId,
x.Account_Id,
x.B2BIcon,
x.B2BBackground,
x.ClassId,
x.ClassName,
x.ClassStatus,
x.CourseId,
x.CourseName,
x.TotalHours,
x.CompleteHours,
SurplusHours = x.TotalHours - x.CompleteHours
}));
}
/// <summary>
/// 获取学习课程回顾
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStudyCourseReview() {
var appletUserInfo = base.AppletUserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int ClassId = parms.GetInt("ClassId", 0);
if (ClassId <= 0) {
return ApiResult.ParamIsNull("请传递班级ID");
}
int Day = 7;//默认最近7天
var Robj = classModule.GetStudyCourseReview(ClassId, Day, appletUserInfo.Group_Id);
return ApiResult.Success("", Robj);
}
#endregion
#region 我的课表 #region 我的课表
/// <summary> /// <summary>
...@@ -678,14 +886,14 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -678,14 +886,14 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GeLearningGardenPage() public ApiResult GeLearningGardenPage()
{ {
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString()); var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_LearningGarden_ViewModel() var query = new RB_LearningGarden_ViewModel()
{ {
Title = base.ParmJObj.GetStringValue("Title"), Title = base.ParmJObj.GetStringValue("Title"),
Group_Id = base.ParmJObj.GetInt("Group_Id") Group_Id = base.ParmJObj.GetInt("Group_Id"),
GardenType = (Common.Enum.Course.LearningGardenTypeEnum)base.ParmJObj.GetInt("GardenType")
}; };
query.Status = DateStateEnum.Normal; query.Status = DateStateEnum.Normal;
query.Group_Id = base.AppletUserInfo.Group_Id; query.Group_Id = base.AppletUserInfo.Group_Id;
...@@ -722,7 +930,6 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -722,7 +930,6 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetLearningGarden() public ApiResult GetLearningGarden()
{ {
var Id = base.ParmJObj.GetInt("Id", 0); var Id = base.ParmJObj.GetInt("Id", 0);
......
...@@ -141,12 +141,11 @@ namespace Edu.WebApi.Controllers.APP ...@@ -141,12 +141,11 @@ namespace Edu.WebApi.Controllers.APP
requestFrom = Common.Enum.ApiRequestFromEnum.AppletStudent, requestFrom = Common.Enum.ApiRequestFromEnum.AppletStudent,
uid = model.Id.ToString() uid = model.Id.ToString()
}; };
string token = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_User_Key, eduUserInfo);
//上传配置 //上传配置
var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault(); var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault();
string token = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_User_Key, eduUserInfo);
#region 获取甲鹤小程序端token #region 获取甲鹤小程序端token
//查询用户信息 //查询用户信息
var umodel = studentModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { TenantId = Convert.ToInt32(Config.JHTenantId), MallBaseId = Convert.ToInt32(Config.JHMallBaseId), Source = 1, OpenId = Config.JHMallUserOpenId }); var umodel = studentModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { TenantId = Convert.ToInt32(Config.JHTenantId), MallBaseId = Convert.ToInt32(Config.JHMallBaseId), Source = 1, OpenId = Config.JHMallUserOpenId });
...@@ -290,11 +289,39 @@ namespace Edu.WebApi.Controllers.APP ...@@ -290,11 +289,39 @@ namespace Edu.WebApi.Controllers.APP
requestFrom = Common.Enum.ApiRequestFromEnum.AppletStudent, requestFrom = Common.Enum.ApiRequestFromEnum.AppletStudent,
uid = model.Id.ToString() uid = model.Id.ToString()
}; };
string token = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_User_Key, eduUserInfo);
//上传配置 //上传配置
var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault(); var uploadConfig = publicModule.GetFileStoreList(new Model.Public.RB_File_Store() { Group_Id = model.Group_Id, IsDefault = 1 })?.FirstOrDefault();
#region 获取甲鹤小程序端token
//查询用户信息
var umodel = studentModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { TenantId = Convert.ToInt32(Config.JHTenantId), MallBaseId = Convert.ToInt32(Config.JHMallBaseId), Source = 1, OpenId = Config.JHMallUserOpenId });
//if (umodel == null)
//{
// return ApiResult.Failed(message: "用户不存在", new { Error = -1 });
//}
IUserInfoToken mallUserInfo = new ErpTokenUserInfo { uid = umodel.Id.ToString(), requestFrom = Common.Enum.ApiRequestFromEnum.MallMiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch + Config.JwtExpirTime},
{"mall_userInfo",mallUserInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
string mallUserToken = encoder.Encode(payload, secret);
#endregion
#endregion
string token = WebApiTokenHelper.CreateToken(Common.GlobalKey.JWT_User_Key, eduUserInfo);
AppletStudentInfo obj = new AppletStudentInfo AppletStudentInfo obj = new AppletStudentInfo
{ {
Id = model.Id, Id = model.Id,
...@@ -306,10 +333,14 @@ namespace Edu.WebApi.Controllers.APP ...@@ -306,10 +333,14 @@ namespace Edu.WebApi.Controllers.APP
AccountName = model.AccountName, AccountName = model.AccountName,
SchoolName = studentModel.SName, SchoolName = studentModel.SName,
TeacherName = studentModel.TeacherName, TeacherName = studentModel.TeacherName,
CourseName = studentModel.CourseName,
StuSex = studentModel.StuSex,
StuBirth = studentModel.StuBirth.HasValue ? studentModel.StuBirth.Value.ToString("yyyy-MM-dd") : "",
Token = token, Token = token,
GroupLogo = model.GroupLogo, GroupLogo = model.GroupLogo,
UserIcon = model.UserIcon, UserIcon = model.UserIcon,
EnterPhone = Cache.User.UserReidsCache.GetUserLoginInfo(studentModel.EnterID).UserMobile, EnterPhone = Cache.User.UserReidsCache.GetUserLoginInfo(studentModel.EnterID).UserMobile,
MallToken = mallUserToken,
ApiRequestFromEnum = Common.Enum.ApiRequestFromEnum.AppletStudent, ApiRequestFromEnum = Common.Enum.ApiRequestFromEnum.AppletStudent,
JHMallBaseId = Config.JHMallBaseId, JHMallBaseId = Config.JHMallBaseId,
JHTenantId = Config.JHTenantId, JHTenantId = Config.JHTenantId,
......
...@@ -227,6 +227,7 @@ namespace Edu.WebApi.Controllers.LearningGarden ...@@ -227,6 +227,7 @@ namespace Edu.WebApi.Controllers.LearningGarden
extModel.TypeId = "news"; extModel.TypeId = "news";
extModel.Group_Id = base.UserInfo.Group_Id; extModel.Group_Id = base.UserInfo.Group_Id;
extModel.Status = DateStateEnum.Normal; extModel.Status = DateStateEnum.Normal;
extModel.GardenType = Common.Enum.Course.LearningGardenTypeEnum.Japanese;//默认日语
learningGardenList.Add(extModel); learningGardenList.Add(extModel);
} }
} }
......
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