修复H5导览与讲解状态闭环
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-19 17:07:40 +08:00
parent 97788a3e9f
commit 3cba97b786
12 changed files with 147 additions and 44 deletions

View File

@@ -13,6 +13,10 @@ import {
import {
createGuideRouteRepository
} from '@/repositories/createGuideRouteRepository'
import {
applyRouteReadinessGate,
NAV_ROUTE_READINESS
} from '@/domain/guideReadiness'
const toSearchText = (target: GuideRouteTarget) => [
target.name,
@@ -41,13 +45,15 @@ export class GuideRouteUseCase {
constructor(private readonly repository: GuideRouteRepository = createGuideRouteRepository()) {}
async getRouteReadiness() {
if (this.readinessCache) return this.readinessCache
if (this.readinessCache) return applyRouteReadinessGate(this.readinessCache)
this.readinessCache = await this.repository.getRouteReadiness()
return this.readinessCache
this.readinessCache = applyRouteReadinessGate(await this.repository.getRouteReadiness())
return applyRouteReadinessGate(this.readinessCache)
}
async listTargets() {
const readiness = await this.getRouteReadiness()
if (!readiness.ready) return []
if (this.targetsCache) return this.targetsCache
this.targetsCache = (await this.repository.listRouteTargets())
@@ -69,11 +75,11 @@ export class GuideRouteUseCase {
async planRoute(request: GuideRoutePlanRequest): Promise<GuideRoutePlanResult> {
try {
const readiness = await this.getRouteReadiness()
const readiness = applyRouteReadinessGate(await this.getRouteReadiness())
if (!readiness.ready) {
return {
route: null,
error: readiness.message || '当前可查看位置预览和位置关系,暂不提供正式室内导航'
error: readiness.message || NAV_ROUTE_READINESS.message
}
}