|
|
|
|
@ -64,11 +64,16 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$list = CourseSign::with(['course.typeDetail', 'user', 'courseContentCheck' => function ($query) use ($all) {
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
$list = CourseSign::with([
|
|
|
|
|
'course.typeDetail',
|
|
|
|
|
'user',
|
|
|
|
|
'courseContentCheck' => function ($query) use ($all) {
|
|
|
|
|
$query->whereColumn('course_content_checks.user_id', 'course_signs.user_id');
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}])->whereHas('user', function ($query) use ($all) {
|
|
|
|
|
])->whereHas('user', function ($query) use ($all) {
|
|
|
|
|
if (isset($all['name'])) {
|
|
|
|
|
$query->where('name', 'like', '%' . $all['name'] . '%');
|
|
|
|
|
}
|
|
|
|
|
@ -115,13 +120,23 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
->orderBy('created_at', 'desc');
|
|
|
|
|
// if (isset($all['has_check'])) {
|
|
|
|
|
// if ($all['has_check'] == 1) {
|
|
|
|
|
// $list = $list->whereHas('courseContentCheck');
|
|
|
|
|
// } else {
|
|
|
|
|
// $list = $list->whereDoesntHave('courseContentCheck');
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if (isset($all['has_check'])) {
|
|
|
|
|
if ($all['has_check'] == 1) {
|
|
|
|
|
$list = $list->whereHas('courseContentCheck', function ($query) use ($all) {
|
|
|
|
|
$query->whereColumn('course_content_checks.user_id', 'course_signs.user_id');
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
$list = $list->whereDoesntHave('courseContentCheck', function ($query) use ($all) {
|
|
|
|
|
$query->whereColumn('course_content_checks.user_id', 'course_signs.user_id');
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['is_export']) && !empty($all['is_export'])) {
|
|
|
|
|
$list = $list->limit(5000)->get()->toArray();
|
|
|
|
|
foreach ($list as $item) {
|
|
|
|
|
|