完善活动运营域与联调标准化

This commit is contained in:
2026-04-03 13:11:41 +08:00
parent 0e28f70bad
commit 129ea935db
56 changed files with 11004 additions and 196 deletions

View File

@@ -29,10 +29,37 @@ export interface GameVariantLaunchContext {
assignmentMode?: string | null
}
export interface GameRuntimeLaunchContext {
runtimeBindingId?: string | null
placeId?: string | null
placeName?: string | null
mapId?: string | null
mapName?: string | null
tileReleaseId?: string | null
courseSetId?: string | null
courseVariantId?: string | null
routeCode?: string | null
}
export interface GamePresentationLaunchContext {
presentationId?: string | null
templateKey?: string | null
version?: string | null
}
export interface GameContentBundleLaunchContext {
bundleId?: string | null
bundleType?: string | null
version?: string | null
}
export interface GameLaunchEnvelope {
config: GameConfigLaunchRequest
business: BusinessLaunchContext | null
variant?: GameVariantLaunchContext | null
runtime?: GameRuntimeLaunchContext | null
presentation?: GamePresentationLaunchContext | null
contentBundle?: GameContentBundleLaunchContext | null
}
export interface MapPageLaunchOptions {
@@ -57,6 +84,20 @@ export interface MapPageLaunchOptions {
variantId?: string
variantName?: string
assignmentMode?: string
runtimeBindingId?: string
placeId?: string
placeName?: string
mapId?: string
mapName?: string
tileReleaseId?: string
courseSetId?: string
courseVariantId?: string
presentationId?: string
presentationTemplateKey?: string
presentationVersion?: string
contentBundleId?: string
contentBundleType?: string
contentBundleVersion?: string
}
type PendingGameLaunchStore = Record<string, GameLaunchEnvelope>
@@ -154,6 +195,78 @@ function buildVariantLaunchContext(options?: MapPageLaunchOptions | null): GameV
}
}
function buildRuntimeLaunchContext(options?: MapPageLaunchOptions | null): GameRuntimeLaunchContext | null {
if (!options) {
return null
}
const runtimeBindingId = normalizeOptionalString(options.runtimeBindingId)
const placeId = normalizeOptionalString(options.placeId)
const placeName = normalizeOptionalString(options.placeName)
const mapId = normalizeOptionalString(options.mapId)
const mapName = normalizeOptionalString(options.mapName)
const tileReleaseId = normalizeOptionalString(options.tileReleaseId)
const courseSetId = normalizeOptionalString(options.courseSetId)
const courseVariantId = normalizeOptionalString(options.courseVariantId)
const routeCode = normalizeOptionalString(options.routeCode)
if (!runtimeBindingId && !placeId && !placeName && !mapId && !mapName && !tileReleaseId && !courseSetId && !courseVariantId && !routeCode) {
return null
}
return {
runtimeBindingId,
placeId,
placeName,
mapId,
mapName,
tileReleaseId,
courseSetId,
courseVariantId,
routeCode,
}
}
function buildPresentationLaunchContext(options?: MapPageLaunchOptions | null): GamePresentationLaunchContext | null {
if (!options) {
return null
}
const presentationId = normalizeOptionalString(options.presentationId)
const templateKey = normalizeOptionalString(options.presentationTemplateKey)
const version = normalizeOptionalString(options.presentationVersion)
if (!presentationId && !templateKey && !version) {
return null
}
return {
presentationId,
templateKey,
version,
}
}
function buildContentBundleLaunchContext(options?: MapPageLaunchOptions | null): GameContentBundleLaunchContext | null {
if (!options) {
return null
}
const bundleId = normalizeOptionalString(options.contentBundleId)
const bundleType = normalizeOptionalString(options.contentBundleType)
const version = normalizeOptionalString(options.contentBundleVersion)
if (!bundleId && !bundleType && !version) {
return null
}
return {
bundleId,
bundleType,
version,
}
}
function loadPendingGameLaunchStore(): PendingGameLaunchStore {
try {
const stored = wx.getStorageSync(PENDING_GAME_LAUNCH_STORAGE_KEY)
@@ -180,6 +293,9 @@ export function getDemoGameLaunchEnvelope(preset: DemoGamePreset = 'classic'): G
source: 'demo',
},
variant: null,
runtime: null,
presentation: null,
contentBundle: null,
}
}
@@ -252,6 +368,9 @@ export function resolveGameLaunchEnvelope(options?: MapPageLaunchOptions | null)
},
business: buildBusinessLaunchContext(options),
variant: buildVariantLaunchContext(options),
runtime: buildRuntimeLaunchContext(options),
presentation: buildPresentationLaunchContext(options),
contentBundle: buildContentBundleLaunchContext(options),
}
}