Use fuzzy location for bind fallback
This commit is contained in:
@@ -55,5 +55,5 @@ export default defineAppConfig({
|
|||||||
desc: "用于定位设备位置",
|
desc: "用于定位设备位置",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
requiredPrivateInfos: ["getLocation"],
|
requiredPrivateInfos: ["getFuzzyLocation"],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -216,15 +216,13 @@ export default function Bind() {
|
|||||||
if (!normalizedDeviceId) return
|
if (!normalizedDeviceId) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const location = await Taro.getLocation({
|
const location = await Taro.getFuzzyLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
isHighAccuracy: true,
|
|
||||||
})
|
})
|
||||||
await reportBindInitialLocation(normalizedDeviceId, {
|
await reportBindInitialLocation(normalizedDeviceId, {
|
||||||
latitude: location.latitude,
|
latitude: location.latitude,
|
||||||
longitude: location.longitude,
|
longitude: location.longitude,
|
||||||
coord_type: 'gcj02',
|
coord_type: 'gcj02',
|
||||||
accuracy_m: typeof location.accuracy === 'number' ? Math.round(location.accuracy) : undefined,
|
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('[bind] initial location skipped:', error)
|
console.log('[bind] initial location skipped:', error)
|
||||||
|
|||||||
Reference in New Issue
Block a user