diff --git a/app/Http/Controllers/Mobile/UserController.php b/app/Http/Controllers/Mobile/UserController.php index fe6c490..098c2ee 100755 --- a/app/Http/Controllers/Mobile/UserController.php +++ b/app/Http/Controllers/Mobile/UserController.php @@ -591,11 +591,7 @@ class UserController extends CommonController } // 监测是否正常报名并通过 $courseSigns = CourseSign::where('course_id', $all['course_id']) - ->where(function ($query) use ($all) { - 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) { $query->where('mobile', $all['mobile']); })->where('status', 1) ->first(); @@ -604,7 +600,11 @@ class UserController extends CommonController } $user = User::where('mobile', $all['mobile'])->first(); $list = CourseContentCheck::where('course_id', $all['course_id']) - ->where('user_id', $user->id) + ->where(function ($query) use ($all) { + if (isset($all['course_content_id'])) { + $query->where('course_content_id', $all['course_content_id']); + } + })->where('user_id', $user->id) ->orderBy('created_at', 'desc') ->get(); if ($list->isNotEmpty()) {