Commit fd4f06d2 authored by 黄奎's avatar 黄奎

1111

parent fa09a4b1
......@@ -44,11 +44,11 @@ WHERE 1=1
{
if (query.CourseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Student.courseId), query.CourseId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Teacher_Extend.courseId), query.CourseId);
}
if (!string.IsNullOrWhiteSpace(query.TeacherIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Course_Student.uid), query.TeacherIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Course_Teacher_Extend.uid), query.TeacherIds);
}
if (query.QCourseState > 0)
{
......
......@@ -265,13 +265,14 @@ namespace EduSpider.Spiders.ClassInRule
string paramStr = string.Format(queryStr, courseId);
var content = new StringContent(paramStr, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded");
ICourseRepository courseRepository = new CourseRepository();
ICourseTeacherRepository courseTeacherRepository = new CourseTeacherRepository();
Console.WriteLine(string.Format("开始获取{0}课程详情数据", courseId));
string url = "https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseInfo";
var response = await request.PostAsync(url, content);
var courseInfoResult = response.Content.ReadAsStringAsync().Result;
List<rb_course_hk> list = new();
List<RB_Course_Teacher> teacherList = new();
if (!string.IsNullOrWhiteSpace(courseInfoResult))
{
JObject courseRootObj = JObject.Parse(courseInfoResult);
......@@ -316,12 +317,31 @@ namespace EduSpider.Spiders.ClassInRule
}
courseModel.CoverImg = coverImg;
list.Add(courseModel);
var cTeacherModel= courseTeacherRepository.GetTeacherCourseListRepository(new Model.Query.CourseQuery()
{
CourseId = courseModel.CourseId,
TeacherIds=courseModel.TeacherUid.ToString()
}).FirstOrDefault();
teacherList.Add(new RB_Course_Teacher()
{
id = cTeacherModel?.id ?? 0,
uid = Convert.ToInt32(courseModel.TeacherUid),
phone = courseModel.TeacherAccount,
logo = courseModel.TeacherLogo,
name = courseModel.TeacherName,
courseId = courseId,
courseTeacherId = courseModel.TeacherId
});
}
}
if (list != null && list.Count > 0)
{
courseRepository.BatchSetCourseOtherRepository(list);
}
if (teacherList != null && teacherList.Count > 0)
{
courseTeacherRepository.BatchSetCourseTeacherRepository(teacherList);
}
}
}
}
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