docs: 统一业务资源ID为服务端生成的稳定UUID

更新所有业务API文档,明确持久化资源的正式ID必须为服务端生成的稳定UUID,本地调试或接口失败时可使用语义ID作为fallback。新增数据库迁移脚本0022_opaque_ids,用于将历史语义ID转换为稳定UUID,并同步外键关联、详情记录的key字段以及审计日志的实体ID引用。新增该迁移的单元测试用例,验证ID替换与关联数据同步的逻辑正确性。调整MiniAPP前端代码,优化导航工具函数的格式,移除废弃函数并修改首页跳转逻辑,使用接口返回的UUID作为详情跳转参数。
This commit is contained in:
duanshuwen
2026-08-19 22:28:13 +08:00
parent e082bd2d98
commit d3a246a873
14 changed files with 314 additions and 24 deletions

View File

@@ -4,8 +4,13 @@ type QueryValue = string | number | boolean | undefined | null;
function withQuery(path: string, query: Record<string, QueryValue> = {}) {
const params = Object.entries(query)
.filter(([, value]) => value !== undefined && value !== null && value !== "")
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
.filter(
([, value]) => value !== undefined && value !== null && value !== "",
)
.map(
([key, value]) =>
`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`,
)
.join("&");
return params ? `${path}?${params}` : path;
}
@@ -27,10 +32,6 @@ export function goBack(fallback = "/pages/home/index") {
goRoot(fallback);
}
export function goDemand(destination?: string) {
go("/pages/demand/index", { destination });
}
export function goWildArchives() {
go("/pages/wild-archives/index");
}

View File

@@ -2,10 +2,9 @@
<view class="wq-page">
<view class="wq-phone">
<scroll-view scroll-y class="h-screen no-scrollbar" :show-scrollbar="false">
<HomeHeroCarousel :slides="appState.data.heroSlides" @select="openHero" />
<HomeWanfaRecommendations :items="homeContentState.playRecommendations" @select="openWanfaRecommendation" />
<HomeHeroCarousel :slides="appState.data.heroSlides" />
<HomeExperienceList :items="homeContentState.experiences" @select="openExperience" />
<HomeVehicleGrid :vehicle-options="vehicleOptions" @select="goDemand('贵州')" />
<HomeVehicleGrid :vehicle-options="vehicleOptions" @select="openVehicle" />
<HomeTeamBuilding :items="homeContentState.teamBuildings" @select="openTeamBuilding" />
<HomeWildArchives :items="homeContentState.wildArchives" @select="openWildArchive" @more="openWildArchives" />
</scroll-view>
@@ -21,13 +20,10 @@ import HomeExperienceList from "./components/HomeExperienceList.vue";
import HomeTeamBuilding from "./components/HomeTeamBuilding.vue";
import HomeWildArchives from "./components/HomeWildArchives.vue";
import HomeVehicleGrid from "./components/HomeVehicleGrid.vue";
import HomeWanfaRecommendations from "./components/HomeWanfaRecommendations.vue";
import type { HomeExperience } from "./components/homeExperienceData";
import type { HomeTeamBuilding as HomeTeamBuildingItem } from "./components/homeTeamBuildingData";
import type { HomeWildArchive } from "./components/homeWildArchivesData";
import type { HomeWanfaRecommendation } from "./components/homeWanfaRecommendationData";
import {
goDemand,
goTeamBuildingDetail,
goWanfaRouteDetail,
goWildArchiveDetail,
@@ -42,15 +38,11 @@ onShow(() => {
void loadHomeContent();
});
function openHero(title: string) {
goDemand(title);
}
function openExperience(item: HomeExperience) {
goDemand(item.demandKeyword);
goWanfaRouteDetail(item.id);
}
function openWanfaRecommendation(item: HomeWanfaRecommendation) {
function openVehicle(item: any) {
}