接入编号讲解后端查询
Some checks failed
CI / verify (push) Has been cancelled

- 使用真实讲解编号解析接口替换本地演示映射
- 成功后复用现有详情页并自动播放讲解
- 增加查询状态、业务错误提示和相关测试

Made-with: Proma
This commit is contained in:
lyf
2026-08-25 18:00:52 +08:00
parent 00585a7b48
commit 130f155bdf
13 changed files with 490 additions and 13 deletions

View File

@@ -78,6 +78,11 @@ export interface ExplainHallSummary {
guideStopCount: number
}
export interface ExplainCodeResolution {
code: string
stopId: string
}
export class ExplainUseCase {
constructor(
private readonly explain: ExplainRepository = explainRepository,
@@ -273,6 +278,15 @@ export class ExplainUseCase {
})
}
async resolveExplainCode(code: string, lang: AudioLanguage = dataSourceConfig.audioLanguage as AudioLanguage): Promise<ExplainCodeResolution> {
const stopInfo = await this.audioPlayInfo.getStopInfoByCode(code, lang)
const stopId = stopInfo.resolvedStopId || stopInfo.playTargetId || stopInfo.targetId
if (!stopInfo.available || !stopId) {
throw new Error('该编号的讲解内容暂不可用')
}
return { code: code.trim(), stopId }
}
async enterExplainDetail(request: ExplainDetailEntryRequest) {
const stopId = this.resolveDetailStopId(request)
if (!stopId) throw new Error('讲解点 ID 不能为空')