master
cody 4 months ago
parent 85805fd13a
commit 0b6bcdba06

@ -484,10 +484,7 @@ class CourseController extends CommonController
$content_check_range = Config::getValueByKey('content_check_range'); $content_check_range = Config::getValueByKey('content_check_range');
$courseContent = CourseContent::find($all['course_content_id']); $courseContent = CourseContent::find($all['course_content_id']);
$distance = getDistance($courseContent->longitude, $courseContent->latitude, $all['longitude'], $all['latitude']); $distance = getDistance($courseContent->longitude, $courseContent->latitude, $all['longitude'], $all['latitude']);
if ($distance > $content_check_range) { return $this->success(compact('distance', 'content_check_range'));
return $this->fail([ResponseCode::ERROR_BUSINESS, '超出打卡范围']);
}
return $this->success('成功');
} }
/** /**
@ -564,13 +561,12 @@ class CourseController extends CommonController
if ($validator->fails()) { if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]); return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
} }
// 获取打卡范围,千米
$content_check_range = Config::getValueByKey('content_check_range');
$list = CourseContentCheck::where('course_content_id', $all['course_content_id']) $list = CourseContentCheck::where('course_content_id', $all['course_content_id'])
->where('user_id', $this->getUserId()) ->where('user_id', $this->getUserId())
->orderBy('created_at', 'desc') ->orderBy('created_at', 'desc')
->get(); ->get();
return $this->success(compact('list', 'content_check_range')); return $this->success(compact('list'));
} }
/** /**

Loading…
Cancel
Save