mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
perf: 签到新增高德和腾讯地图
This commit is contained in:
parent
4c075b4d11
commit
16d360c582
@ -506,9 +506,9 @@ class SystemController extends AbstractController
|
|||||||
if (is_array($all['modes'])) {
|
if (is_array($all['modes'])) {
|
||||||
if (in_array('locat', $all['modes'])) {
|
if (in_array('locat', $all['modes'])) {
|
||||||
$mapTypes = [
|
$mapTypes = [
|
||||||
'baidu' => ['key' => 'locat_bd_lbs_key', 'point' => 'locat_bd_lbs_point', 'msg' => '请填写百度地图AK'],
|
'baidu' => ['key' => 'locat_bd_lbs_key', 'point' => 'locat_bd_lbs_point', 'msg' => '请填写百度地图AK'],
|
||||||
'amap' => ['key' => 'locat_amap_key', 'point' => 'locat_amap_point', 'msg' => '请填写高德地图Key'],
|
'amap' => ['key' => 'locat_amap_key', 'point' => 'locat_amap_point', 'msg' => '请填写高德地图Key'],
|
||||||
'tencent' => ['key' => 'locat_tencent_key', 'point' => 'locat_tencent_point', 'msg' => '请填写腾讯地图Key'],
|
'tencent' => ['key' => 'locat_tencent_key', 'point' => 'locat_tencent_point', 'msg' => '请填写腾讯地图Key'],
|
||||||
];
|
];
|
||||||
$type = $all['locat_map_type'];
|
$type = $all['locat_map_type'];
|
||||||
if (!isset($mapTypes[$type])) {
|
if (!isset($mapTypes[$type])) {
|
||||||
|
|||||||
@ -103,16 +103,27 @@ class UserBot extends AbstractModel
|
|||||||
return $menu;
|
return $menu;
|
||||||
}
|
}
|
||||||
if (in_array('locat', $setting['modes']) && Base::isEEUIApp()) {
|
if (in_array('locat', $setting['modes']) && Base::isEEUIApp()) {
|
||||||
$menu[] = [
|
$mapTypes = [
|
||||||
'key' => 'locat-checkin',
|
'baidu' => ['key' => 'locat_bd_lbs_key', 'point' => 'locat_bd_lbs_point', 'msg' => '请填写百度地图AK'],
|
||||||
'label' => Doo::translate('定位签到'),
|
'amap' => ['key' => 'locat_amap_key', 'point' => 'locat_amap_point', 'msg' => '请填写高德地图Key'],
|
||||||
'config' => [
|
'tencent' => ['key' => 'locat_tencent_key', 'point' => 'locat_tencent_point', 'msg' => '请填写腾讯地图Key'],
|
||||||
'key' => $setting['locat_bd_lbs_key'],
|
|
||||||
'lng' => $setting['locat_bd_lbs_point']['lng'],
|
|
||||||
'lat' => $setting['locat_bd_lbs_point']['lat'],
|
|
||||||
'radius' => $setting['locat_bd_lbs_point']['radius'],
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
$type = $setting['locat_map_type'];
|
||||||
|
if (isset($mapTypes[$type])) {
|
||||||
|
$conf = $mapTypes[$type];
|
||||||
|
$point = $setting[$conf['point']];
|
||||||
|
$menu[] = [
|
||||||
|
'key' => 'locat-checkin',
|
||||||
|
'label' => Doo::translate('定位签到'),
|
||||||
|
'config' => [
|
||||||
|
'type' => $type,
|
||||||
|
'key' => $setting[$conf['key']],
|
||||||
|
'lng' => $point['lng'],
|
||||||
|
'lat' => $point['lat'],
|
||||||
|
'radius' => intval($point['radius']),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (in_array('manual', $setting['modes'])) {
|
if (in_array('manual', $setting['modes'])) {
|
||||||
$menu[] = [
|
$menu[] = [
|
||||||
@ -234,7 +245,7 @@ class UserBot extends AbstractModel
|
|||||||
if (empty($extra)) {
|
if (empty($extra)) {
|
||||||
return '当前客户端版本低(所需版本≥v0.39.75)。';
|
return '当前客户端版本低(所需版本≥v0.39.75)。';
|
||||||
}
|
}
|
||||||
if ($extra['type'] === 'bd') {
|
if (in_array($extra['type'], ['baidu', 'amap', 'tencent'])) {
|
||||||
// todo 判断距离
|
// todo 判断距离
|
||||||
} else {
|
} else {
|
||||||
return '错误的定位签到。';
|
return '错误的定位签到。';
|
||||||
|
|||||||
@ -1842,6 +1842,7 @@ export default {
|
|||||||
// 位置签到
|
// 位置签到
|
||||||
case "locat-checkin":
|
case "locat-checkin":
|
||||||
this.$store.dispatch('openAppMapPage', {
|
this.$store.dispatch('openAppMapPage', {
|
||||||
|
type: item.config.type,
|
||||||
key: item.config.key,
|
key: item.config.key,
|
||||||
point: `${item.config.lng},${item.config.lat}`,
|
point: `${item.config.lng},${item.config.lat}`,
|
||||||
radius: item.config.radius,
|
radius: item.config.radius,
|
||||||
@ -1849,27 +1850,14 @@ export default {
|
|||||||
if (!$A.isJson(data)) {
|
if (!$A.isJson(data)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.distance > item.config.radius) {
|
|
||||||
$A.modalError(`你选择的位置「${data.title}」不在签到范围内`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const thumb = $A.urlAddParams('https://api.map.baidu.com/staticimage/v2', {
|
|
||||||
ak: item.config.key,
|
|
||||||
center: `${data.point.lng},${data.point.lat}`,
|
|
||||||
markers: `${data.point.lng},${data.point.lat}`,
|
|
||||||
width: 800,
|
|
||||||
height: 480,
|
|
||||||
zoom: 19,
|
|
||||||
copyright: 1,
|
|
||||||
})
|
|
||||||
this.sendLocationMsg({
|
this.sendLocationMsg({
|
||||||
type: 'bd',
|
type: item.config.type,
|
||||||
lng: data.point.lng,
|
lng: data.point.lng,
|
||||||
lat: data.point.lat,
|
lat: data.point.lat,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
distance: data.distance,
|
distance: data.distance,
|
||||||
address: data.address || '',
|
address: data.address || '',
|
||||||
thumb
|
thumb: data.thumb,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
|||||||
38
resources/assets/js/store/actions.js
vendored
38
resources/assets/js/store/actions.js
vendored
@ -1260,7 +1260,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 打开地图选位置(App)
|
* 打开地图选位置(App)
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param objects {{key: string, point: string}}
|
* @param objects {{type: string, key: string, point: string, radius: number}}
|
||||||
* @returns {Promise<unknown>}
|
* @returns {Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
openAppMapPage({dispatch}, objects) {
|
openAppMapPage({dispatch}, objects) {
|
||||||
@ -1292,6 +1292,42 @@ export default {
|
|||||||
const data = $A.jsonParse($A.eeuiAppGetVariate(`location::${channel}`));
|
const data = $A.jsonParse($A.eeuiAppGetVariate(`location::${channel}`));
|
||||||
if (data.point) {
|
if (data.point) {
|
||||||
$A.eeuiAppSetVariate(`location::${channel}`, "");
|
$A.eeuiAppSetVariate(`location::${channel}`, "");
|
||||||
|
if (data.distance > objects.radius) {
|
||||||
|
$A.modalError(`你选择的位置「${data.title}」不在签到范围内`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.thumb = null;
|
||||||
|
if (objects.type === 'baidu') {
|
||||||
|
data.thumb = $A.urlAddParams('https://api.map.baidu.com/staticimage/v2', {
|
||||||
|
ak: objects.key,
|
||||||
|
center: `${data.point.lng},${data.point.lat}`,
|
||||||
|
markers: `${data.point.lng},${data.point.lat}`,
|
||||||
|
width: 800,
|
||||||
|
height: 480,
|
||||||
|
zoom: 19,
|
||||||
|
copyright: 1,
|
||||||
|
})
|
||||||
|
} else if (objects.type === 'amap') {
|
||||||
|
data.thumb = $A.urlAddParams('https://restapi.amap.com/v3/staticmap', {
|
||||||
|
key: objects.key,
|
||||||
|
center: `${data.point.lng},${data.point.lat}`,
|
||||||
|
markers: `${data.point.lng},${data.point.lat}`,
|
||||||
|
width: 800,
|
||||||
|
height: 480,
|
||||||
|
zoom: 19,
|
||||||
|
copyright: 1,
|
||||||
|
})
|
||||||
|
} else if (objects.type === 'tencent') {
|
||||||
|
data.thumb = $A.urlAddParams('https://apis.map.qq.com/ws/staticmap/v2', {
|
||||||
|
key: objects.key,
|
||||||
|
center: `${data.point.lng},${data.point.lat}`,
|
||||||
|
markers: `${data.point.lng},${data.point.lat}`,
|
||||||
|
width: 800,
|
||||||
|
height: 480,
|
||||||
|
zoom: 19,
|
||||||
|
copyright: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user