From 4c075b4d112a0ebb8ab0ca1e7eb6266c6b2213cb Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 28 Jul 2025 06:22:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=AD=BE=E5=88=B0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=AB=98=E5=BE=B7=E5=92=8C=E8=85=BE=E8=AE=AF=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/SystemController.php | 29 +- public/tools/map/select_amap.html | 286 +++++++++++++++ .../map/{select.html => select_baidu.html} | 23 +- public/tools/map/select_tencent.html | 297 ++++++++++++++++ .../setting/components/SystemCheckin.vue | 326 +++++++++++++++--- .../statics/public/tools/map/select_amap.html | 286 +++++++++++++++ .../map/{select.html => select_baidu.html} | 23 +- .../public/tools/map/select_tencent.html | 297 ++++++++++++++++ 8 files changed, 1505 insertions(+), 62 deletions(-) create mode 100644 public/tools/map/select_amap.html rename public/tools/map/{select.html => select_baidu.html} (90%) create mode 100644 public/tools/map/select_tencent.html create mode 100644 resources/assets/statics/public/tools/map/select_amap.html rename resources/assets/statics/public/tools/map/{select.html => select_baidu.html} (90%) create mode 100644 resources/assets/statics/public/tools/map/select_tencent.html diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php index 0cde48149..ce2e2b4ee 100755 --- a/app/Http/Controllers/Api/SystemController.php +++ b/app/Http/Controllers/Api/SystemController.php @@ -481,8 +481,13 @@ class SystemController extends AbstractController 'face_remark', 'face_retip', 'locat_remark', + 'locat_map_type', 'locat_bd_lbs_key', 'locat_bd_lbs_point', // 格式:{"lng":116.404, "lat":39.915, "radius":500} + 'locat_amap_key', + 'locat_amap_point', // 格式:{"lng":116.404, "lat":39.915, "radius":500} + 'locat_tencent_key', + 'locat_tencent_point', // 格式:{"lng":116.404, "lat":39.915, "radius":500} 'manual_remark', 'modes', 'key', @@ -500,14 +505,25 @@ class SystemController extends AbstractController } if (is_array($all['modes'])) { if (in_array('locat', $all['modes'])) { - if (empty($all['locat_bd_lbs_key'])) { - return Base::retError('请填写百度地图AK'); + $mapTypes = [ + 'baidu' => ['key' => 'locat_bd_lbs_key', 'point' => 'locat_bd_lbs_point', 'msg' => '请填写百度地图AK'], + 'amap' => ['key' => 'locat_amap_key', 'point' => 'locat_amap_point', 'msg' => '请填写高德地图Key'], + 'tencent' => ['key' => 'locat_tencent_key', 'point' => 'locat_tencent_point', 'msg' => '请填写腾讯地图Key'], + ]; + $type = $all['locat_map_type']; + if (!isset($mapTypes[$type])) { + return Base::retError('请选择地图类型'); } - if (!is_array($all['locat_bd_lbs_point'])) { + $conf = $mapTypes[$type]; + if (empty($all[$conf['key']])) { + return Base::retError($conf['msg']); + } + if (!is_array($all[$conf['point']])) { return Base::retError('请选择允许签到位置'); } - $all['locat_bd_lbs_point']['radius'] = intval($all['locat_bd_lbs_point']['radius']); - if (empty($all['locat_bd_lbs_point']['lng']) || empty($all['locat_bd_lbs_point']['lat']) || empty($all['locat_bd_lbs_point']['radius'])) { + $all[$conf['point']]['radius'] = intval($all[$conf['point']]['radius']); + $point = $all[$conf['point']]; + if (empty($point['lng']) || empty($point['lat']) || empty($point['radius'])) { return Base::retError('请选择有效的签到位置'); } } @@ -539,7 +555,10 @@ class SystemController extends AbstractController $setting['face_remark'] = $setting['face_remark'] ?: Doo::translate('考勤机'); $setting['face_retip'] = $setting['face_retip'] ?: 'open'; $setting['locat_remark'] = $setting['locat_remark'] ?: Doo::translate('定位签到'); + $setting['locat_map_type'] = $setting['locat_map_type'] ?: 'baidu'; $setting['locat_bd_lbs_point'] = is_array($setting['locat_bd_lbs_point']) ? $setting['locat_bd_lbs_point'] : ['radius' => 500]; + $setting['locat_amap_point'] = is_array($setting['locat_amap_point']) ? $setting['locat_amap_point'] : ['radius' => 500]; + $setting['locat_tencent_point'] = is_array($setting['locat_tencent_point']) ? $setting['locat_tencent_point'] : ['radius' => 500]; $setting['manual_remark'] = $setting['manual_remark'] ?: Doo::translate('手动签到'); $setting['time'] = $setting['time'] ? Base::json2array($setting['time']) : ['09:00', '18:00']; $setting['advance'] = intval($setting['advance']) ?: 120; diff --git a/public/tools/map/select_amap.html b/public/tools/map/select_amap.html new file mode 100644 index 000000000..e80307529 --- /dev/null +++ b/public/tools/map/select_amap.html @@ -0,0 +1,286 @@ + + + + + + + + + +
+ + \ No newline at end of file diff --git a/public/tools/map/select.html b/public/tools/map/select_baidu.html similarity index 90% rename from public/tools/map/select.html rename to public/tools/map/select_baidu.html index 13310a11b..1539c54ef 100644 --- a/public/tools/map/select.html +++ b/public/tools/map/select_baidu.html @@ -29,6 +29,8 @@ right: 0; bottom: 0; } + + + + +
+ + \ No newline at end of file diff --git a/resources/assets/js/pages/manage/setting/components/SystemCheckin.vue b/resources/assets/js/pages/manage/setting/components/SystemCheckin.vue index 6a820ecff..e124d8992 100644 --- a/resources/assets/js/pages/manage/setting/components/SystemCheckin.vue +++ b/resources/assets/js/pages/manage/setting/components/SystemCheckin.vue @@ -125,20 +125,71 @@ - - - - - - - - - {{$L('点击设置')}} + + + {{ $L('百度地图') }} + {{ $L('高德地图') }} + {{ $L('腾讯地图') }} + +
{{$L('仅支持移动端App')}}
+ + + + + + + + + @@ -171,38 +222,140 @@ - + + :styles="{ + width: '90%', + maxWidth: '1000px' + }">
-
{{ $L(`签到半径${bdSelectPoint.radius}米`) }}
-
{{ $L('请点击地图选择签到位置') }}
-