fix(bug):和信智汇学院上线培训 · 2026/11/27 10:00对该课程扫码签到如图所示学员信息丢失了!请核对矫正!
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
This commit is contained in:
1 parent
4f77907a8a
commit
0c471efb9f
8 files changed
+52
-11
No files matched your search
@@ -783,7 +783,12 @@ func (s *trainingService) CreateSignCode(ctx context.Context, tenantID uint64, s
|
||||
if err != nil {
|
||||
return nil, errors.NewNotFoundError("课程场次不存在")
|
||||
}
|
||||
if radius <= 0 {
|
||||
// 半径兜底仅在真实圆心下生效:前端生成签到码不携带定位(圆心为零值)时
|
||||
// 不启用围栏 —— 否则 (0,0)+300m 会把所有真实扫码判成定位异常(距离一万
|
||||
// 公里级)。需要围栏时由生成方显式传 geo_lat/geo_lng。
|
||||
if lat == 0 && lng == 0 {
|
||||
radius = 0
|
||||
} else if radius <= 0 {
|
||||
radius = int(s.ruleFloat(ctx, tenantID, types.RuleKeySignPolicy, "geo_radius_m", 300))
|
||||
}
|
||||
now := time.Now()
|
||||
@@ -982,9 +987,10 @@ func (s *trainingService) Checkin(ctx context.Context, tenantID uint64, userID s
|
||||
status = types.TrainingSignLate
|
||||
}
|
||||
|
||||
// 定位围栏判定。
|
||||
// 定位围栏判定。圆心 (0,0) 视为未配置(生成签到码不带定位时圆心落零值):
|
||||
// 距离按 0 记、不打 outside —— 否则圆心在几万公里外,全国任意扫码全是定位异常。
|
||||
distance := 0.0
|
||||
if code.GeoRadius > 0 {
|
||||
if code.GeoRadius > 0 && (code.GeoLat != 0 || code.GeoLng != 0) {
|
||||
distance = haversineMeters(lat, lng, code.GeoLat, code.GeoLng)
|
||||
if distance > float64(code.GeoRadius) {
|
||||
flags = append(flags, "outside")
|
||||
|
||||
Reference in new issue
Block a user