Files
crawler-plugin/frontend-vue/src/pages/amazon/download-btn.ts
T
huangzd1997 8b95dd0dc1 feat(教程管理): 后台可上传教程包,工具台按最新上传下载
- admin-vue 新增「记录与版本 → 教程管理」页(menuKey admin_tutorial):
  zip 浏览器直传 MinIO(presign → PUT 带进度 → confirm 落库)+ 列表/下载/删除,
  最新一条标「当前生效」;补操作指引与 align-tutorial 守卫测试。
- frontend-vue 工具台「立即下载教程」进页面取 /api/tutorial/latest(最新上传优先),
  接口异常或无记录回退历史固定直链,按钮不失效。
- Java 侧 tutorial 模块与 V119 迁移已在 de9686ec 提交并上线(2026-09-13)。

vue-tsc + 两端单测(工具台 695 / 后台 1617)通过;生产已实测
presign→PUT→confirm→latest 切换→删除回落全链路。
2026-09-13 23:48:24 +08:00

21 lines
1003 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 工具台首页「立即下载教程」:优先取后台「教程管理」最新上传的包(GET /api/tutorial/latest,
* 见 shared/api/tutorial.ts);接口异常或无记录时回退到历史固定直链。
*
* 固定直链对象位于 MinIO 公开 client 桶(host A minio 容器,openresty 反代 oss.aishufu.top),
* 由 scripts/upload_tutorial_zip.py 上传(同 key 覆盖更新),保留作为兜底。
*/
import { fetchLatestTutorialPackage } from '@/shared/api/tutorial'
export const TUTORIAL_DOWNLOAD_URL = 'https://oss.aishufu.top/client/tutorial/数富AI-教学客户端.zip'
/** 解析当前生效的教程包直链:最新上传优先;接口异常/无记录时静默回退固定直链,保证按钮始终可下载。 */
export async function resolveTutorialDownloadUrl(): Promise<string> {
try {
const latest = await fetchLatestTutorialPackage()
return latest?.fileUrl || TUTORIAL_DOWNLOAD_URL
} catch {
return TUTORIAL_DOWNLOAD_URL
}
}