|
|
|
|
@ -223,7 +223,7 @@ class CourseController extends CommonController
|
|
|
|
|
*/
|
|
|
|
|
public function myCourse()
|
|
|
|
|
{
|
|
|
|
|
$list = Course::with('typeDetail','courseContentEvaluation')->with(['courseSigns' => function ($query) {
|
|
|
|
|
$list = Course::with('typeDetail', 'courseContentEvaluation')->with(['courseSigns' => function ($query) {
|
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
|
}])->whereHas('courseSigns', function ($query) {
|
|
|
|
|
$query->where('user_id', $this->getUserId());
|
|
|
|
|
@ -652,6 +652,7 @@ class CourseController extends CommonController
|
|
|
|
|
* path="/api/mobile/course/content-check-list",
|
|
|
|
|
* tags={"小程序-课程"},
|
|
|
|
|
* summary="获取签到记录",
|
|
|
|
|
* @OA\Parameter(name="course_id", in="query", @OA\Schema(type="string"), required=false, description="课程id"),
|
|
|
|
|
* @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="string"), required=false, description="课表id"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
@ -662,18 +663,14 @@ class CourseController extends CommonController
|
|
|
|
|
public function contentCheckList()
|
|
|
|
|
{
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
$messages = [
|
|
|
|
|
'course_content_id.required' => '课程id必填',
|
|
|
|
|
];
|
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
|
'course_content_id' => 'required'
|
|
|
|
|
], $messages);
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$list = CourseContentCheck::where('course_content_id', $all['course_content_id'])
|
|
|
|
|
->where('user_id', $this->getUserId())
|
|
|
|
|
$list = CourseContentCheck::where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
|
$query->where('course_id', $all['course_id']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
}
|
|
|
|
|
})->where('user_id', $this->getUserId())
|
|
|
|
|
->orderBy('created_at', 'desc')
|
|
|
|
|
->get();
|
|
|
|
|
return $this->success(compact('list'));
|
|
|
|
|
|