master
cody 5 months ago
parent d05197516a
commit d7391e3c24

@ -66,9 +66,10 @@ class OtherController extends CommonController
'total' => User::count() - collect($industryTotal)->sum('total') 'total' => User::count() - collect($industryTotal)->sum('total')
]; ];
// 课程统计 // 课程统计
$courseTypes = CourseType::where('is_chart',1)->get(); $courseTypes = CourseType::where('is_chart', 1)->get();
foreach ($courseTypes as $courseType) { foreach ($courseTypes as $courseType) {
$courseType->course_signs_total = CourseSign::whereIn('course_id', $courseType->courses->pluck('id')) $courseIds = Course::where('type', $courseType->id)->pluck('id');
$courseType->course_signs_total = CourseSign::whereIn('course_id', $courseIds)
->where('status', 1) ->where('status', 1)
->count(); ->count();
} }

Loading…
Cancel
Save