|
|
|
|
@ -620,6 +620,9 @@ class CourseController extends CommonController
|
|
|
|
|
// 获取打卡范围,千米
|
|
|
|
|
$content_check_range = Config::getValueByKey('content_check_range');
|
|
|
|
|
$course = Course::find($all['course_id']);
|
|
|
|
|
if (empty($course->longitude) || empty($course->latitude)) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, '请先设置课程经纬度']);
|
|
|
|
|
}
|
|
|
|
|
$distance = getDistance($course->longitude, $course->latitude, $all['longitude'], $all['latitude']);
|
|
|
|
|
if ($distance > $content_check_range) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_BUSINESS, '超出打卡范围']);
|
|
|
|
|
|