|
@@ -122,41 +122,24 @@ class Education
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- * 获取课程详细信息
|
|
|
- * @param $gr_id
|
|
|
- * @return array
|
|
|
- * @throws \think\db\exception\DataNotFoundException
|
|
|
- * @throws \think\db\exception\DbException
|
|
|
- * @throws \think\db\exception\ModelNotFoundException
|
|
|
- */
|
|
|
- public function getCourseInfo($gr_id) {
|
|
|
- $courses = DB::table('table_education_course')
|
|
|
- ->where('course_status', 1)
|
|
|
- ->whereIn('gr_id', (array) $gr_id)
|
|
|
+ public function getCourseList($gr_id)
|
|
|
+ {
|
|
|
+
|
|
|
+ $courseList = EducationCourse::where('course_status', 1)
|
|
|
+ ->where('gr_id', $gr_id)
|
|
|
->where('course_audit', 1)
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- $course_list = [];
|
|
|
- foreach ($courses as $course) {
|
|
|
- $course_info = [
|
|
|
- 'course_id' => $course->course_id,
|
|
|
- 'course_name' => $course->course_name,
|
|
|
- 'course_cover' => $course->course_cover,
|
|
|
-
|
|
|
- ];
|
|
|
- $course_list[] = $course_info;
|
|
|
- }
|
|
|
- $count_and_all = $this->getCountAndAlll($gr_id);
|
|
|
- $result = [
|
|
|
- 'course_list' => $course_list,
|
|
|
- 'count' => $count_and_all[0]['count'],
|
|
|
- 'alll' => $count_and_all[0]['alll']
|
|
|
- ];
|
|
|
- return $result;
|
|
|
+ ->select();
|
|
|
+
|
|
|
+
|
|
|
+ return json([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => 'success',
|
|
|
+ 'data' => $courseList
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|