|
|
@ -39,25 +39,25 @@ class CourseService extends BaseApiService |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//课程列表 |
|
|
//课程列表 |
|
|
public function list($id,$data) |
|
|
public function list($id, $data) |
|
|
{ |
|
|
{ |
|
|
$campus_person_role = new CampusPersonRole(); |
|
|
$campus_person_role = new CampusPersonRole(); |
|
|
$where = []; |
|
|
$where = []; |
|
|
if ($data['schedule_date']) { |
|
|
if ($data['schedule_date']) { |
|
|
$where[] = ['course_date','=', $data['schedule_date']]; |
|
|
$where[] = ['course_date', '=', $data['schedule_date']]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$campus_id = $campus_person_role->where(['person_id' => $id])->column('campus_id'); |
|
|
$campus_id = $campus_person_role->where(['person_id' => $id])->column('campus_id'); |
|
|
|
|
|
|
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$search_model = $CourseSchedule |
|
|
$search_model = $CourseSchedule |
|
|
->where('campus_id','in',$campus_id) |
|
|
->where('campus_id', 'in', $campus_id) |
|
|
->where($where) |
|
|
->where($where) |
|
|
->with(['course' => function($query) { |
|
|
->with(['course' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'venue' => function($query) { |
|
|
}, 'venue' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'campus','studentCourses']); |
|
|
}, 'campus', 'studentCourses']); |
|
|
$list = $this->pageQuery($search_model); |
|
|
$list = $this->pageQuery($search_model); |
|
|
foreach ($list['data'] as $k => $v) { |
|
|
foreach ($list['data'] as $k => $v) { |
|
|
$student = Db::name('person_course_schedule') |
|
|
$student = Db::name('person_course_schedule') |
|
|
@ -72,6 +72,7 @@ class CourseService extends BaseApiService |
|
|
} |
|
|
} |
|
|
return $list; |
|
|
return $list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//获取课程详情 |
|
|
//获取课程详情 |
|
|
public function info($data) |
|
|
public function info($data) |
|
|
{ |
|
|
{ |
|
|
@ -79,11 +80,11 @@ class CourseService extends BaseApiService |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$search_model = $CourseSchedule |
|
|
$search_model = $CourseSchedule |
|
|
->where('id', $data) |
|
|
->where('id', $data) |
|
|
->with(['course' => function($query) { |
|
|
->with(['course' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'venue' => function($query) { |
|
|
}, 'venue' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'coach' => function($query) { |
|
|
}, 'coach' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
}]); |
|
|
}]); |
|
|
$list = $search_model->find(); |
|
|
$list = $search_model->find(); |
|
|
@ -104,8 +105,7 @@ class CourseService extends BaseApiService |
|
|
->select()->toArray(); |
|
|
->select()->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($student_courses as &$v) { |
|
|
foreach ($student_courses as &$v){ |
|
|
|
|
|
$student = Db::name('student') |
|
|
$student = Db::name('student') |
|
|
->alias('st') |
|
|
->alias('st') |
|
|
->where('st.id', $v['student_id']) |
|
|
->where('st.id', $v['student_id']) |
|
|
@ -113,13 +113,13 @@ class CourseService extends BaseApiService |
|
|
->join('school_member sm', 'cr.member_id = sm.member_id') |
|
|
->join('school_member sm', 'cr.member_id = sm.member_id') |
|
|
->field('st.name, sm.headimg as avatar,cr.id as resources_id,cr.source') |
|
|
->field('st.name, sm.headimg as avatar,cr.id as resources_id,cr.source') |
|
|
->find(); |
|
|
->find(); |
|
|
if($student){ |
|
|
if ($student) { |
|
|
$v['school_six_speed'] = $school_six_speed->where(['staff_id' => $student['resources_id']])->find(); |
|
|
$v['school_six_speed'] = $school_six_speed->where(['staff_id' => $student['resources_id']])->find(); |
|
|
|
|
|
|
|
|
}else{ |
|
|
} else { |
|
|
$v['school_six_speed'] = []; |
|
|
$v['school_six_speed'] = []; |
|
|
} |
|
|
} |
|
|
$v['source'] = get_dict_value("source",$student['source']); |
|
|
$v['source'] = get_dict_value("source", $student['source']); |
|
|
$v['name'] = $student['name']; |
|
|
$v['name'] = $student['name']; |
|
|
$v['avatar'] = $student['avatar']; |
|
|
$v['avatar'] = $student['avatar']; |
|
|
} |
|
|
} |
|
|
@ -127,9 +127,9 @@ class CourseService extends BaseApiService |
|
|
|
|
|
|
|
|
$Assignment = new Assignment(); |
|
|
$Assignment = new Assignment(); |
|
|
$search_model = $Assignment->where('course_id', $data) |
|
|
$search_model = $Assignment->where('course_id', $data) |
|
|
->with(['student' => function($query) { |
|
|
->with(['student' => function ($query) { |
|
|
$query->with(['customerResources' => function($query) { |
|
|
$query->with(['customerResources' => function ($query) { |
|
|
$query->with(['member' => function($query) { |
|
|
$query->with(['member' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
}]); |
|
|
}]); |
|
|
}]); |
|
|
}]); |
|
|
@ -140,12 +140,12 @@ class CourseService extends BaseApiService |
|
|
$groupedByStatus3 = []; |
|
|
$groupedByStatus3 = []; |
|
|
|
|
|
|
|
|
foreach ($search_model_res as $item) { |
|
|
foreach ($search_model_res as $item) { |
|
|
if ($item['status'] == 1){ |
|
|
if ($item['status'] == 1) { |
|
|
array_push($groupedByStatus1,$item); |
|
|
array_push($groupedByStatus1, $item); |
|
|
} else if ($item['status'] == 2){ |
|
|
} else if ($item['status'] == 2) { |
|
|
array_push($groupedByStatus2,$item); |
|
|
array_push($groupedByStatus2, $item); |
|
|
} else if ($item['status'] == 3){ |
|
|
} else if ($item['status'] == 3) { |
|
|
array_push($groupedByStatus3,$item); |
|
|
array_push($groupedByStatus3, $item); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
$list['groupedByStatus1'] = $groupedByStatus1; |
|
|
$list['groupedByStatus1'] = $groupedByStatus1; |
|
|
@ -160,17 +160,17 @@ class CourseService extends BaseApiService |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$search_model = $CourseSchedule |
|
|
$search_model = $CourseSchedule |
|
|
->where('coach_id', $data) |
|
|
->where('coach_id', $data) |
|
|
->with(['course' => function($query) { |
|
|
->with(['course' => function ($query) { |
|
|
$query->with(['studentCourses' => function($query) { |
|
|
$query->with(['studentCourses' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
}]); |
|
|
}]); |
|
|
},'venue' => function($query) { |
|
|
}, 'venue' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'coach' => function($query) { |
|
|
}, 'coach' => function ($query) { |
|
|
$query->select(); |
|
|
$query->select(); |
|
|
},'campus']); |
|
|
}, 'campus']); |
|
|
$list = $this->pageQuery($search_model); |
|
|
$list = $this->pageQuery($search_model); |
|
|
foreach ($list['data'] as &$v){ |
|
|
foreach ($list['data'] as &$v) { |
|
|
$student = Db::name('person_course_schedule') |
|
|
$student = Db::name('person_course_schedule') |
|
|
->alias('pcs') |
|
|
->alias('pcs') |
|
|
->where('pcs.schedule_id', $v['id']) |
|
|
->where('pcs.schedule_id', $v['id']) |
|
|
@ -198,7 +198,7 @@ class CourseService extends BaseApiService |
|
|
{ |
|
|
{ |
|
|
$StudentCourses = new StudentCourses(); |
|
|
$StudentCourses = new StudentCourses(); |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$student_arr = $PersonCourseSchedule->where('schedule_id',$id)->column('student_id'); |
|
|
$student_arr = $PersonCourseSchedule->where('schedule_id', $id)->column('student_id'); |
|
|
|
|
|
|
|
|
// 获取当前时间 |
|
|
// 获取当前时间 |
|
|
$now = date('Y-m-d H:i:s'); |
|
|
$now = date('Y-m-d H:i:s'); |
|
|
@ -274,10 +274,10 @@ class CourseService extends BaseApiService |
|
|
{ |
|
|
{ |
|
|
$StudentCourseUsage = new StudentCourseUsage(); |
|
|
$StudentCourseUsage = new StudentCourseUsage(); |
|
|
$StudentCourses = new StudentCourses(); |
|
|
$StudentCourses = new StudentCourses(); |
|
|
$StudentCourses_id = $StudentCourses->where('student_id',$data['student_id'])->where('course_id',$data['course_id'])->value('id'); |
|
|
$StudentCourses_id = $StudentCourses->where('student_id', $data['student_id'])->where('course_id', $data['course_id'])->value('id'); |
|
|
$PersonCourseSchedule_id = $StudentCourseUsage->where('student_course_id',$StudentCourses_id)->value('id'); |
|
|
$PersonCourseSchedule_id = $StudentCourseUsage->where('student_course_id', $StudentCourses_id)->value('id'); |
|
|
if ($PersonCourseSchedule_id) { |
|
|
if ($PersonCourseSchedule_id) { |
|
|
$StudentCourseUsage->where('student_course_id',$StudentCourses_id)->delete(); |
|
|
$StudentCourseUsage->where('student_course_id', $StudentCourses_id)->delete(); |
|
|
return true; |
|
|
return true; |
|
|
} else { |
|
|
} else { |
|
|
return false; |
|
|
return false; |
|
|
@ -297,10 +297,10 @@ class CourseService extends BaseApiService |
|
|
$tempDate->modify("$i days"); |
|
|
$tempDate->modify("$i days"); |
|
|
|
|
|
|
|
|
$status = false; |
|
|
$status = false; |
|
|
if($baseDate['day'] == $tempDate->format('d')){ |
|
|
if ($baseDate['day'] == $tempDate->format('d')) { |
|
|
$status = true; |
|
|
$status = true; |
|
|
}else if(empty($baseDate['day'])){ |
|
|
} else if (empty($baseDate['day'])) { |
|
|
if($tempDate->format('Y-m-d') === date('Y-m-d')){ |
|
|
if ($tempDate->format('Y-m-d') === date('Y-m-d')) { |
|
|
$status = true; |
|
|
$status = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -312,7 +312,7 @@ class CourseService extends BaseApiService |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ['dates' => $dates,'date' => $this_date]; |
|
|
return ['dates' => $dates, 'date' => $this_date]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -322,15 +322,15 @@ class CourseService extends BaseApiService |
|
|
|
|
|
|
|
|
// 基础日期查询 |
|
|
// 基础日期查询 |
|
|
if ($data['schedule_date']) { |
|
|
if ($data['schedule_date']) { |
|
|
$where[] = ['course_date','=', $data['schedule_date']]; |
|
|
$where[] = ['course_date', '=', $data['schedule_date']]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 日期范围查询 |
|
|
// 日期范围查询 |
|
|
if (!empty($data['start_date'])) { |
|
|
if (!empty($data['start_date'])) { |
|
|
$where[] = ['course_date','>=', $data['start_date']]; |
|
|
$where[] = ['course_date', '>=', $data['start_date']]; |
|
|
} |
|
|
} |
|
|
if (!empty($data['end_date'])) { |
|
|
if (!empty($data['end_date'])) { |
|
|
$where[] = ['course_date','<=', $data['end_date']]; |
|
|
$where[] = ['course_date', '<=', $data['end_date']]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 场地编号筛选 - 根据venue表的id或venue_name进行筛选 |
|
|
// 场地编号筛选 - 根据venue表的id或venue_name进行筛选 |
|
|
@ -391,7 +391,7 @@ class CourseService extends BaseApiService |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$list = $query |
|
|
$list = $query |
|
|
->with(['course','venue','campus','coach']) |
|
|
->with(['course', 'venue', 'campus', 'coach']) |
|
|
->select()->toArray(); |
|
|
->select()->toArray(); |
|
|
|
|
|
|
|
|
foreach ($list as $k => $v) { |
|
|
foreach ($list as $k => $v) { |
|
|
@ -428,7 +428,8 @@ class CourseService extends BaseApiService |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function addSchedule(array $data){ |
|
|
public function addSchedule(array $data) |
|
|
|
|
|
{ |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
$personCourseSchedule = new PersonCourseSchedule(); |
|
|
$personCourseSchedule = new PersonCourseSchedule(); |
|
|
$student = Student::where('id', $data['student_id'])->find(); |
|
|
$student = Student::where('id', $data['student_id'])->find(); |
|
|
@ -439,28 +440,42 @@ class CourseService extends BaseApiService |
|
|
$studentCourse = StudentCourses::where('student_id', $student->id) |
|
|
$studentCourse = StudentCourses::where('student_id', $student->id) |
|
|
->order('id', 'desc') |
|
|
->order('id', 'desc') |
|
|
->find(); |
|
|
->find(); |
|
|
if ($studentCourse){ |
|
|
if ($studentCourse) { |
|
|
$person_type = 'student'; |
|
|
$person_type = 'student'; |
|
|
}else{ |
|
|
} else { |
|
|
$person_type = 'customer_resource'; |
|
|
$person_type = 'customer_resource'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 检查重复添加 - 根据person_type使用不同的检查逻辑 |
|
|
// 检查重复添加 - 根据person_type使用不同的检查逻辑 |
|
|
$checkWhere = [ |
|
|
$checkWhere = [ |
|
|
'schedule_id' => $data['schedule_id'], |
|
|
'schedule_id' => $data['schedule_id'], |
|
|
'student_id'=>$student->id, |
|
|
'student_id' => $student->id, |
|
|
'resources_id'=>$data['resources_id'], |
|
|
'resources_id' => $data['resources_id'], |
|
|
|
|
|
'status' => 0 |
|
|
]; |
|
|
]; |
|
|
$course = $personCourseSchedule->where($checkWhere)->find(); |
|
|
$course = $personCourseSchedule->where($checkWhere)->find(); |
|
|
if($course){ |
|
|
if ($course) { |
|
|
if ($course->schedule_type == 2 && $course->course_type == 1) { |
|
|
if ($course->schedule_type == 2 && $course->course_type == 1) { |
|
|
$course->schedule_type == 1; |
|
|
$course->schedule_type == 1; |
|
|
$course->save(); |
|
|
$course->save(); |
|
|
}else{ |
|
|
} else { |
|
|
return fail("重复添加"); |
|
|
return fail("重复添加"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 判断课程类型: |
|
|
|
|
|
// - 如果person_type是customer_resource则course_type设为3(等待位) |
|
|
|
|
|
// - 如果person_type是customer_resource且schedule_type是1(正式位),则course_type设为2(体验课学员) |
|
|
|
|
|
// - 如果person_type是student,则course_type设为1(正式学员) |
|
|
|
|
|
$courseType = 1; // 默认正式学员 |
|
|
|
|
|
if ($person_type == 'customer_resource') { |
|
|
|
|
|
if (($data['schedule_type'] ?? 1) == 2) { |
|
|
|
|
|
$courseType = 3; // 等待位 |
|
|
|
|
|
} else { |
|
|
|
|
|
$courseType = 2; // 体验课学员 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$insertData = [ |
|
|
$insertData = [ |
|
|
'student_id' => $student->id, // 正确设置student_id |
|
|
'student_id' => $student->id, // 正确设置student_id |
|
|
'resources_id' => $data['resources_id'], // 正确设置resources_id |
|
|
'resources_id' => $data['resources_id'], // 正确设置resources_id |
|
|
@ -470,21 +485,22 @@ class CourseService extends BaseApiService |
|
|
'course_date' => $data['course_date'], |
|
|
'course_date' => $data['course_date'], |
|
|
'time_slot' => $data['time_slot'], |
|
|
'time_slot' => $data['time_slot'], |
|
|
'schedule_type' => $data['schedule_type'] ?? 1, // 1=正式位, 2=等待位 |
|
|
'schedule_type' => $data['schedule_type'] ?? 1, // 1=正式位, 2=等待位 |
|
|
'course_type' => empty($course) ? 2 : 1, // 1=正式学员, 2=体验课学员 |
|
|
'course_type' => $courseType, // 根据上面的逻辑设置课程类型 |
|
|
'remark' => $data['remark'] ?? '' // 备注 |
|
|
'remark' => $data['remark'] ?? '' // 备注 |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
$personCourseSchedule->insert($insertData); |
|
|
$personCourseSchedule->insert($insertData); |
|
|
$student_ids = $personCourseSchedule->where(['schedule_id' => $data['schedule_id']])->column('student_id'); |
|
|
$student_ids = $personCourseSchedule->where(['schedule_id' => $data['schedule_id']])->column('student_id'); |
|
|
$CourseSchedule->where(['id' => $data['schedule_id']])->update([ |
|
|
$CourseSchedule->where(['id' => $data['schedule_id']])->update([ |
|
|
'student_ids'=>$student_ids, |
|
|
'student_ids' => $student_ids, |
|
|
'available_capacity'=>count($student_ids) |
|
|
'available_capacity' => count($student_ids) |
|
|
]); |
|
|
]); |
|
|
return success("添加成功"); |
|
|
return success("添加成功"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function schedule_list(array $data){ |
|
|
public function schedule_list(array $data) |
|
|
|
|
|
{ |
|
|
$personCourseSchedule = new PersonCourseSchedule(); |
|
|
$personCourseSchedule = new PersonCourseSchedule(); |
|
|
$list = $personCourseSchedule |
|
|
$list = $personCourseSchedule |
|
|
->alias('a') |
|
|
->alias('a') |
|
|
@ -517,7 +533,7 @@ class CourseService extends BaseApiService |
|
|
$record = $personCourseSchedule->where([ |
|
|
$record = $personCourseSchedule->where([ |
|
|
'schedule_id' => $data['id'], |
|
|
'schedule_id' => $data['id'], |
|
|
'resources_id' => $data['resources_id'], |
|
|
'resources_id' => $data['resources_id'], |
|
|
|
|
|
'student_id' => $data['student_id'] |
|
|
])->find(); |
|
|
])->find(); |
|
|
|
|
|
|
|
|
if (!$record) { |
|
|
if (!$record) { |
|
|
@ -528,20 +544,15 @@ class CourseService extends BaseApiService |
|
|
if ($record['person_type'] == 'customer_resource') { |
|
|
if ($record['person_type'] == 'customer_resource') { |
|
|
// 如果是客户资源类型,直接删除记录 |
|
|
// 如果是客户资源类型,直接删除记录 |
|
|
$personCourseSchedule->where([ |
|
|
$personCourseSchedule->where([ |
|
|
'schedule_id' => $data['id'], |
|
|
'id' => $record->id, |
|
|
'resources_id' => $data['resources_id'] |
|
|
'resources_id' => $data['resources_id'] |
|
|
])->delete(); |
|
|
])->delete(); |
|
|
|
|
|
|
|
|
// 更新课程安排表的可用容量 |
|
|
|
|
|
$CourseSchedule = new CourseSchedule(); |
|
|
|
|
|
$CourseSchedule->where(['id' => $record['schedule_id']])->inc("available_capacity")->update(); |
|
|
|
|
|
|
|
|
|
|
|
return success('删除成功'); |
|
|
return success('删除成功'); |
|
|
} else if ($record['person_type'] == 'student') { |
|
|
} else if ($record['person_type'] == 'student') { |
|
|
// 如果是学生类型,更新状态为2并更新备注 |
|
|
// 如果是学生类型,更新状态为2并更新备注 |
|
|
$personCourseSchedule->where([ |
|
|
$personCourseSchedule->where([ |
|
|
'id' => $data['id'], |
|
|
'id' => $record->id |
|
|
'resources_id' => $data['resources_id'] |
|
|
|
|
|
])->update([ |
|
|
])->update([ |
|
|
'status' => 2, |
|
|
'status' => 2, |
|
|
'remark' => $data['remark'] |
|
|
'remark' => $data['remark'] |
|
|
@ -739,10 +750,11 @@ class CourseService extends BaseApiService |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 获取已安排的学员列表(包括正式学员和等待位) |
|
|
// 获取已安排的学员列表(包括正式学员和等待位),只显示未请假的学员(status=0) |
|
|
$students = $PersonCourseSchedule |
|
|
$students = $PersonCourseSchedule |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where(function($query) { |
|
|
->where('status', 0) // 只获取未请假的学员 |
|
|
|
|
|
->where(function ($query) { |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
}) |
|
|
}) |
|
|
->with(['student', 'resources']) |
|
|
->with(['student', 'resources']) |
|
|
@ -957,7 +969,7 @@ class CourseService extends BaseApiService |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$existingRecords = $PersonCourseSchedule |
|
|
$existingRecords = $PersonCourseSchedule |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where(function($query) { |
|
|
->where(function ($query) { |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
}) |
|
|
}) |
|
|
->field('student_id, resources_id') |
|
|
->field('student_id, resources_id') |
|
|
@ -1096,7 +1108,7 @@ class CourseService extends BaseApiService |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$PersonCourseSchedule = new PersonCourseSchedule(); |
|
|
$existingWhere = [ |
|
|
$existingWhere = [ |
|
|
['schedule_id', '=', $scheduleId], |
|
|
['schedule_id', '=', $scheduleId], |
|
|
function($query) { |
|
|
function ($query) { |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
} |
|
|
} |
|
|
]; |
|
|
]; |
|
|
@ -1144,7 +1156,7 @@ class CourseService extends BaseApiService |
|
|
$currentCount = $PersonCourseSchedule |
|
|
$currentCount = $PersonCourseSchedule |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where('course_type', '<>', 3) // 不包括等待位 |
|
|
->where('course_type', '<>', 3) // 不包括等待位 |
|
|
->where(function($query) { |
|
|
->where(function ($query) { |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
}) |
|
|
}) |
|
|
->count(); |
|
|
->count(); |
|
|
@ -1339,7 +1351,7 @@ class CourseService extends BaseApiService |
|
|
// 获取当前安排的所有人员 |
|
|
// 获取当前安排的所有人员 |
|
|
$participants = $PersonCourseSchedule |
|
|
$participants = $PersonCourseSchedule |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where('schedule_id', $scheduleId) |
|
|
->where(function($query) { |
|
|
->where(function ($query) { |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
$query->where('deleted_at', 0)->whereOr('deleted_at', null); |
|
|
}) |
|
|
}) |
|
|
->field('resources_id, student_id') |
|
|
->field('resources_id, student_id') |
|
|
|