完善活动运营域与联调标准化
This commit is contained in:
@@ -45,6 +45,30 @@ export interface BackendLaunchVariantSummary {
|
||||
assignmentMode?: string | null
|
||||
}
|
||||
|
||||
export interface BackendRuntimeSummary {
|
||||
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 BackendPresentationSummary {
|
||||
presentationId?: string | null
|
||||
templateKey?: string | null
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export interface BackendContentBundleSummary {
|
||||
bundleId?: string | null
|
||||
bundleType?: string | null
|
||||
version?: string | null
|
||||
}
|
||||
|
||||
export interface BackendEntrySessionSummary {
|
||||
id: string
|
||||
status: string
|
||||
@@ -55,6 +79,7 @@ export interface BackendEntrySessionSummary {
|
||||
routeCode?: string | null
|
||||
variantId?: string | null
|
||||
variantName?: string | null
|
||||
runtime?: BackendRuntimeSummary | null
|
||||
launchedAt?: string | null
|
||||
startedAt?: string | null
|
||||
endedAt?: string | null
|
||||
@@ -115,6 +140,8 @@ export interface BackendEventPlayResult {
|
||||
summary?: string | null
|
||||
status: string
|
||||
}
|
||||
currentPresentation?: BackendPresentationSummary | null
|
||||
currentContentBundle?: BackendContentBundleSummary | null
|
||||
release?: {
|
||||
id: string
|
||||
configLabel: string
|
||||
@@ -159,6 +186,9 @@ export interface BackendLaunchResult {
|
||||
routeCode?: string | null
|
||||
}
|
||||
variant?: BackendLaunchVariantSummary | null
|
||||
runtime?: BackendRuntimeSummary | null
|
||||
presentation?: BackendPresentationSummary | null
|
||||
contentBundle?: BackendContentBundleSummary | null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +209,7 @@ export interface BackendSessionResult {
|
||||
clientType: string
|
||||
deviceKey: string
|
||||
routeCode?: string | null
|
||||
runtime?: BackendRuntimeSummary | null
|
||||
sessionTokenExpiresAt: string
|
||||
launchedAt: string
|
||||
startedAt?: string | null
|
||||
|
||||
@@ -2,6 +2,10 @@ import { type GameLaunchEnvelope } from './gameLaunch'
|
||||
import { type BackendLaunchResult } from './backendApi'
|
||||
|
||||
export function adaptBackendLaunchResultToEnvelope(result: BackendLaunchResult): GameLaunchEnvelope {
|
||||
const launchVariantRouteCode = result.launch.variant
|
||||
? (result.launch.variant.routeCode || null)
|
||||
: null
|
||||
|
||||
return {
|
||||
config: {
|
||||
configUrl: result.launch.config.configUrl,
|
||||
@@ -29,5 +33,32 @@ export function adaptBackendLaunchResultToEnvelope(result: BackendLaunchResult):
|
||||
routeCode: result.launch.config.routeCode || result.launch.business.routeCode || null,
|
||||
}
|
||||
: null,
|
||||
runtime: result.launch.runtime
|
||||
? {
|
||||
runtimeBindingId: result.launch.runtime.runtimeBindingId || null,
|
||||
placeId: result.launch.runtime.placeId || null,
|
||||
placeName: result.launch.runtime.placeName || null,
|
||||
mapId: result.launch.runtime.mapId || null,
|
||||
mapName: result.launch.runtime.mapName || null,
|
||||
tileReleaseId: result.launch.runtime.tileReleaseId || null,
|
||||
courseSetId: result.launch.runtime.courseSetId || null,
|
||||
courseVariantId: result.launch.runtime.courseVariantId || null,
|
||||
routeCode: result.launch.runtime.routeCode || launchVariantRouteCode || result.launch.config.routeCode || result.launch.business.routeCode || null,
|
||||
}
|
||||
: null,
|
||||
presentation: result.launch.presentation
|
||||
? {
|
||||
presentationId: result.launch.presentation.presentationId || null,
|
||||
templateKey: result.launch.presentation.templateKey || null,
|
||||
version: result.launch.presentation.version || null,
|
||||
}
|
||||
: null,
|
||||
contentBundle: result.launch.contentBundle
|
||||
? {
|
||||
bundleId: result.launch.contentBundle.bundleId || null,
|
||||
bundleType: result.launch.contentBundle.bundleType || null,
|
||||
version: result.launch.contentBundle.version || null,
|
||||
}
|
||||
: null,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user