forked from zhouruizhe/gmTouringMiniApp
32 lines
903 B
TypeScript
32 lines
903 B
TypeScript
import { getPoiRepository } from '@/data/poi'
|
|
import { CHECK_IN_RADIUS_METERS } from '@/domain/check-in'
|
|
|
|
export interface CheckInTask {
|
|
poiId: string
|
|
radiusMeters: number
|
|
status: 'poc_enabled'
|
|
verificationNote: string
|
|
}
|
|
|
|
function createCheckInTask(poiId: string): CheckInTask {
|
|
return {
|
|
poiId,
|
|
radiusMeters: CHECK_IN_RADIUS_METERS,
|
|
status: 'poc_enabled',
|
|
verificationNote: 'POC 开放点位,正式发布前需在 iOS 真机复核游客入口坐标与安全到达区域。',
|
|
}
|
|
}
|
|
|
|
export function getCheckInTask(poiId: string): CheckInTask | null {
|
|
const normalizedPoiId = poiId.trim()
|
|
if (!normalizedPoiId || !getPoiRepository().getPoiById(normalizedPoiId))
|
|
return null
|
|
return createCheckInTask(normalizedPoiId)
|
|
}
|
|
|
|
export function getCheckInTasks(): CheckInTask[] {
|
|
return getPoiRepository()
|
|
.getPublishedPois()
|
|
.map(poi => createCheckInTask(poi.id))
|
|
}
|