|
|
|
@ -17,6 +17,7 @@ use App\Models\CourseContentCheck;
|
|
|
|
use App\Models\CourseContentEvaluation;
|
|
|
|
use App\Models\CourseContentEvaluation;
|
|
|
|
use App\Models\CourseContentEvaluationForm;
|
|
|
|
use App\Models\CourseContentEvaluationForm;
|
|
|
|
use App\Models\CourseSign;
|
|
|
|
use App\Models\CourseSign;
|
|
|
|
|
|
|
|
use App\Models\CourseType;
|
|
|
|
use App\Models\Notice;
|
|
|
|
use App\Models\Notice;
|
|
|
|
use App\Models\Order;
|
|
|
|
use App\Models\Order;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Models\User;
|
|
|
|
@ -553,13 +554,13 @@ class CourseController extends CommonController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$all = \request()->all();
|
|
|
|
$all = \request()->all();
|
|
|
|
$messages = [
|
|
|
|
$messages = [
|
|
|
|
// 'longitude.required' => '经度必填',
|
|
|
|
// 'longitude.required' => '经度必填',
|
|
|
|
// 'latitude.required' => '纬度必填',
|
|
|
|
// 'latitude.required' => '纬度必填',
|
|
|
|
'course_content_id.required' => '课表id必填',
|
|
|
|
'course_content_id.required' => '课表id必填',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
// 'longitude' => 'required',
|
|
|
|
// 'longitude' => 'required',
|
|
|
|
// 'latitude' => 'required',
|
|
|
|
// 'latitude' => 'required',
|
|
|
|
'course_content_id' => 'required'
|
|
|
|
'course_content_id' => 'required'
|
|
|
|
], $messages);
|
|
|
|
], $messages);
|
|
|
|
if ($validator->fails()) {
|
|
|
|
if ($validator->fails()) {
|
|
|
|
@ -588,8 +589,8 @@ class CourseController extends CommonController
|
|
|
|
'course_content_id' => $all['course_content_id'],
|
|
|
|
'course_content_id' => $all['course_content_id'],
|
|
|
|
'course_id' => $courseContent->course_id,
|
|
|
|
'course_id' => $courseContent->course_id,
|
|
|
|
'user_id' => $this->getUserId(),
|
|
|
|
'user_id' => $this->getUserId(),
|
|
|
|
'longitude' => $all['longitude']??'',
|
|
|
|
'longitude' => $all['longitude'] ?? '',
|
|
|
|
'latitude' => $all['latitude']??'',
|
|
|
|
'latitude' => $all['latitude'] ?? '',
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
// 同日期课程批量签到
|
|
|
|
// 同日期课程批量签到
|
|
|
|
$batch_sign = request('batch_sign', 0);
|
|
|
|
$batch_sign = request('batch_sign', 0);
|
|
|
|
@ -639,12 +640,12 @@ class CourseController extends CommonController
|
|
|
|
$all = \request()->all();
|
|
|
|
$all = \request()->all();
|
|
|
|
$messages = [
|
|
|
|
$messages = [
|
|
|
|
'longitude.required' => '经度必填',
|
|
|
|
'longitude.required' => '经度必填',
|
|
|
|
// 'latitude.required' => '纬度必填',
|
|
|
|
// 'latitude.required' => '纬度必填',
|
|
|
|
// 'course_id.required' => '课表id必填',
|
|
|
|
// 'course_id.required' => '课表id必填',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
// 'longitude' => 'required',
|
|
|
|
// 'longitude' => 'required',
|
|
|
|
// 'latitude' => 'required',
|
|
|
|
// 'latitude' => 'required',
|
|
|
|
'course_id' => 'required'
|
|
|
|
'course_id' => 'required'
|
|
|
|
], $messages);
|
|
|
|
], $messages);
|
|
|
|
if ($validator->fails()) {
|
|
|
|
if ($validator->fails()) {
|
|
|
|
@ -675,8 +676,8 @@ class CourseController extends CommonController
|
|
|
|
CourseContentCheck::create([
|
|
|
|
CourseContentCheck::create([
|
|
|
|
'course_id' => $all['course_id'],
|
|
|
|
'course_id' => $all['course_id'],
|
|
|
|
'user_id' => $this->getUserId(),
|
|
|
|
'user_id' => $this->getUserId(),
|
|
|
|
'longitude' => $all['longitude']??'',
|
|
|
|
'longitude' => $all['longitude'] ?? '',
|
|
|
|
'latitude' => $all['latitude']??'',
|
|
|
|
'latitude' => $all['latitude'] ?? '',
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
return $this->success('课程签到成功');
|
|
|
|
return $this->success('课程签到成功');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -798,11 +799,32 @@ class CourseController extends CommonController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
$list = $list->orderBy('letter')
|
|
|
|
$list = $list->orderBy('letter')->paginate(10);
|
|
|
|
->paginate(10);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$list = $list->orderBy('letter')->paginate(20);
|
|
|
|
$list = $list->orderBy('letter')->paginate(20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取当前用户参与报名
|
|
|
|
|
|
|
|
$userCourseSigns = CourseSign::where('user_id',$this->getUserId())->where('status', 1)->get();
|
|
|
|
|
|
|
|
// 获取当前用户允许的课程体系
|
|
|
|
|
|
|
|
$open_course_types = explode(',', $this->getUser()->open_course_types);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($list as $user) {
|
|
|
|
|
|
|
|
$user->open_mobile = false;
|
|
|
|
|
|
|
|
// 只对开放的课程体系和本班人员开放手机号
|
|
|
|
|
|
|
|
// 获取本班的课程
|
|
|
|
|
|
|
|
$courseIds = $user->courseSigns->where('status', 1)->pluck('course_id')->toArray();
|
|
|
|
|
|
|
|
// 判断当前用户和$user课程是否存在交集
|
|
|
|
|
|
|
|
if (count(array_intersect($courseIds, $userCourseSigns->pluck('course_id')->toArray())) > 0) {
|
|
|
|
|
|
|
|
$user->open_mobile = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取用户的课程体系
|
|
|
|
|
|
|
|
$coursesTypeIds = Course::whereIn('id', $userCourseSigns->pluck('course_id'))->pluck('type')->toArray();
|
|
|
|
|
|
|
|
// 判断当前用户和$user课程体系是否存在交集
|
|
|
|
|
|
|
|
if (count(array_intersect($coursesTypeIds, $open_course_types)) > 0) {
|
|
|
|
|
|
|
|
$user->open_mobile = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$teacher = [];
|
|
|
|
$teacher = [];
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
if (isset($all['type']) && $all['type'] == 2) {
|
|
|
|
$course = Course::find($all['course_id']);
|
|
|
|
$course = Course::find($all['course_id']);
|
|
|
|
|