推进活动列表第一刀与联调回归
This commit is contained in:
@@ -31,6 +31,11 @@ type DemoBootstrapSummary struct {
|
||||
VariantManualEventID string `json:"variantManualEventId"`
|
||||
VariantManualRelease string `json:"variantManualReleaseId"`
|
||||
VariantManualCardID string `json:"variantManualCardId"`
|
||||
VariantManualSourceID string `json:"variantManualSourceId"`
|
||||
VariantManualBuildID string `json:"variantManualBuildId"`
|
||||
VariantManualCourseSet string `json:"variantManualCourseSetId"`
|
||||
VariantManualVariantID string `json:"variantManualCourseVariantId"`
|
||||
VariantManualRuntimeID string `json:"variantManualRuntimeBindingId"`
|
||||
CleanedSessionCount int64 `json:"cleanedSessionCount"`
|
||||
}
|
||||
|
||||
@@ -44,7 +49,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
var tenantID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO tenants (tenant_code, name, status)
|
||||
VALUES ('tenant_demo', 'Demo Tenant', 'active')
|
||||
VALUES ('tenant_demo', '联调租户', 'active')
|
||||
ON CONFLICT (tenant_code) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
status = EXCLUDED.status
|
||||
@@ -58,7 +63,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
INSERT INTO entry_channels (
|
||||
tenant_id, channel_code, channel_type, platform_app_id, display_name, status, is_default
|
||||
)
|
||||
VALUES ($1, 'mini-demo', 'wechat_mini', 'wx-demo-appid', 'Demo Mini Channel', 'active', true)
|
||||
VALUES ($1, 'mini-demo', 'wechat_mini', 'wx-demo-appid', '小程序联调入口', 'active', true)
|
||||
ON CONFLICT (tenant_id, channel_code) DO UPDATE SET
|
||||
channel_type = EXCLUDED.channel_type,
|
||||
platform_app_id = EXCLUDED.platform_app_id,
|
||||
@@ -75,7 +80,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
INSERT INTO events (
|
||||
tenant_id, event_public_id, slug, display_name, summary, status
|
||||
)
|
||||
VALUES ($1, 'evt_demo_001', 'demo-city-run', 'Demo City Run', 'Launch flow demo event', 'active')
|
||||
VALUES ($1, 'evt_demo_001', 'city-park-classic', '领秀城公园顺序赛', '顺序赛联调样例活动', 'active')
|
||||
ON CONFLICT (event_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
slug = EXCLUDED.slug,
|
||||
@@ -106,7 +111,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
'rel_demo_001',
|
||||
$1,
|
||||
1,
|
||||
'Demo Config v1',
|
||||
'顺序赛联调配置 v1',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/event/releases/evt_demo_001/rel_e7dd953743c5c0d2/manifest.json',
|
||||
'demo-checksum-001',
|
||||
'route-demo-001',
|
||||
@@ -132,7 +137,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
return nil, fmt.Errorf("attach demo release: %w", err)
|
||||
}
|
||||
|
||||
sourceNotes := "demo source config imported from local event sample"
|
||||
sourceNotes := "顺序赛联调 source 配置"
|
||||
source, err := s.UpsertEventConfigSource(ctx, tx, UpsertEventConfigSourceParams{
|
||||
EventID: eventID,
|
||||
SourceVersionNo: 1,
|
||||
@@ -144,7 +149,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
Source: map[string]any{
|
||||
"app": map[string]any{
|
||||
"id": "sample-classic-001",
|
||||
"title": "顺序赛示例",
|
||||
"title": "领秀城公园顺序赛",
|
||||
},
|
||||
"branding": map[string]any{
|
||||
"tenantCode": "tenant_demo",
|
||||
@@ -173,7 +178,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
return nil, fmt.Errorf("ensure demo event config source: %w", err)
|
||||
}
|
||||
|
||||
buildLog := "demo build generated from sample classic-sequential.json"
|
||||
buildLog := "顺序赛联调 build 产物"
|
||||
build, err := s.UpsertEventConfigBuild(ctx, tx, UpsertEventConfigBuildParams{
|
||||
EventID: eventID,
|
||||
SourceID: source.ID,
|
||||
@@ -186,7 +191,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
"version": "2026.04.01",
|
||||
"app": map[string]any{
|
||||
"id": "sample-classic-001",
|
||||
"title": "顺序赛示例",
|
||||
"title": "领秀城公园顺序赛",
|
||||
},
|
||||
"map": map[string]any{
|
||||
"tiles": "https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/",
|
||||
@@ -296,20 +301,26 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id,
|
||||
display_slot,
|
||||
display_priority,
|
||||
status
|
||||
status,
|
||||
is_default_experience,
|
||||
starts_at,
|
||||
ends_at
|
||||
)
|
||||
VALUES (
|
||||
'card_demo_001',
|
||||
$1,
|
||||
$2,
|
||||
'event',
|
||||
'Demo City Run',
|
||||
'今日推荐路线',
|
||||
'领秀城公园顺序赛',
|
||||
'顺序赛推荐入口',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/assets/demo-cover.jpg',
|
||||
$3,
|
||||
'home_primary',
|
||||
100,
|
||||
'active'
|
||||
'active',
|
||||
true,
|
||||
NOW() - INTERVAL '1 day',
|
||||
NOW() + INTERVAL '30 day'
|
||||
)
|
||||
ON CONFLICT (card_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
@@ -321,7 +332,10 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id = EXCLUDED.event_id,
|
||||
display_slot = EXCLUDED.display_slot,
|
||||
display_priority = EXCLUDED.display_priority,
|
||||
status = EXCLUDED.status
|
||||
status = EXCLUDED.status,
|
||||
is_default_experience = EXCLUDED.is_default_experience,
|
||||
starts_at = EXCLUDED.starts_at,
|
||||
ends_at = EXCLUDED.ends_at
|
||||
RETURNING card_public_id
|
||||
`, tenantID, channelID, eventID).Scan(&cardPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure demo card: %w", err)
|
||||
@@ -333,7 +347,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
place_public_id, code, name, region, status
|
||||
)
|
||||
VALUES (
|
||||
'place_demo_001', 'place-demo-001', 'Demo Park', 'Shanghai', 'active'
|
||||
'place_demo_001', 'place-demo-001', '领秀城公园', 'Shanghai', 'active'
|
||||
)
|
||||
ON CONFLICT (code) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
@@ -350,7 +364,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
map_asset_public_id, place_id, code, name, map_type, status
|
||||
)
|
||||
VALUES (
|
||||
'mapasset_demo_001', $1, 'mapasset-demo-001', 'Demo Asset Map', 'standard', 'active'
|
||||
'mapasset_demo_001', $1, 'mapasset-demo-001', '领秀城公园基础底图', 'standard', 'active'
|
||||
)
|
||||
ON CONFLICT (code) DO UPDATE SET
|
||||
place_id = EXCLUDED.place_id,
|
||||
@@ -429,7 +443,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
course_set_public_id, place_id, map_asset_id, code, mode, name, status
|
||||
)
|
||||
VALUES (
|
||||
'cset_demo_001', $1, $2, 'cset-demo-001', 'classic-sequential', 'Demo Course Set', 'active'
|
||||
'cset_demo_001', $1, $2, 'cset-demo-001', 'classic-sequential', '顺序赛标准赛道', 'active'
|
||||
)
|
||||
ON CONFLICT (code) DO UPDATE SET
|
||||
place_id = EXCLUDED.place_id,
|
||||
@@ -448,7 +462,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
course_variant_public_id, course_set_id, source_id, name, route_code, mode, control_count, status, is_default
|
||||
)
|
||||
VALUES (
|
||||
'cvariant_demo_001', $1, $2, 'Demo Variant A', 'route-demo-a', 'classic-sequential', 8, 'active', true
|
||||
'cvariant_demo_001', $1, $2, '顺序赛 A 线', 'route-demo-a', 'classic-sequential', 8, 'active', true
|
||||
)
|
||||
ON CONFLICT (course_variant_public_id) DO UPDATE SET
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
@@ -470,7 +484,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
course_variant_public_id, course_set_id, source_id, name, route_code, mode, control_count, status, is_default
|
||||
)
|
||||
VALUES (
|
||||
'cvariant_demo_002', $1, $2, 'Demo Variant B', 'route-demo-b', 'classic-sequential', 10, 'active', false
|
||||
'cvariant_demo_002', $1, $2, '顺序赛 B 线', 'route-demo-b', 'classic-sequential', 10, 'active', false
|
||||
)
|
||||
ON CONFLICT (course_variant_public_id) DO UPDATE SET
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
@@ -500,7 +514,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
runtime_binding_public_id, event_id, place_id, map_asset_id, tile_release_id, course_set_id, course_variant_id, status, notes
|
||||
)
|
||||
VALUES (
|
||||
'runtime_demo_001', $1, $2, $3, $4, $5, $6, 'active', 'demo runtime binding'
|
||||
'runtime_demo_001', $1, $2, $3, $4, $5, $6, 'active', '顺序赛联调运行绑定'
|
||||
)
|
||||
ON CONFLICT (runtime_binding_public_id) DO UPDATE SET
|
||||
event_id = EXCLUDED.event_id,
|
||||
@@ -521,7 +535,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
INSERT INTO events (
|
||||
tenant_id, event_public_id, slug, display_name, summary, status
|
||||
)
|
||||
VALUES ($1, 'evt_demo_variant_manual_001', 'demo-variant-manual-run', 'Demo Variant Manual Run', 'Manual 多赛道联调活动', 'active')
|
||||
VALUES ($1, 'evt_demo_variant_manual_001', 'city-park-manual-variant', '领秀城公园多赛道挑战', '手动多赛道联调样例活动', 'active')
|
||||
ON CONFLICT (event_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
slug = EXCLUDED.slug,
|
||||
@@ -553,7 +567,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
'rel_demo_variant_manual_001',
|
||||
$1,
|
||||
1,
|
||||
'Demo Variant Manual Config v1',
|
||||
'多赛道联调配置 v1',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/event/releases/evt_demo_001/rel_e7dd953743c5c0d2/manifest.json',
|
||||
'demo-variant-checksum-001',
|
||||
'route-variant-a',
|
||||
@@ -614,20 +628,26 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id,
|
||||
display_slot,
|
||||
display_priority,
|
||||
status
|
||||
status,
|
||||
is_default_experience,
|
||||
starts_at,
|
||||
ends_at
|
||||
)
|
||||
VALUES (
|
||||
'card_demo_variant_manual_001',
|
||||
$1,
|
||||
$2,
|
||||
'event',
|
||||
'Demo Variant Manual Run',
|
||||
'多赛道手动选择联调',
|
||||
'领秀城公园多赛道挑战',
|
||||
'手动选择赛道入口',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/assets/demo-cover.jpg',
|
||||
$3,
|
||||
'home_primary',
|
||||
95,
|
||||
'active'
|
||||
'active',
|
||||
false,
|
||||
NOW() - INTERVAL '1 day',
|
||||
NOW() + INTERVAL '30 day'
|
||||
)
|
||||
ON CONFLICT (card_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
@@ -639,18 +659,242 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id = EXCLUDED.event_id,
|
||||
display_slot = EXCLUDED.display_slot,
|
||||
display_priority = EXCLUDED.display_priority,
|
||||
status = EXCLUDED.status
|
||||
status = EXCLUDED.status,
|
||||
is_default_experience = EXCLUDED.is_default_experience,
|
||||
starts_at = EXCLUDED.starts_at,
|
||||
ends_at = EXCLUDED.ends_at
|
||||
RETURNING card_public_id
|
||||
`, tenantID, channelID, manualEventID).Scan(&manualCardPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo card: %w", err)
|
||||
}
|
||||
|
||||
manualSourceNotes := "多赛道联调 source 配置"
|
||||
manualSource, err := s.UpsertEventConfigSource(ctx, tx, UpsertEventConfigSourceParams{
|
||||
EventID: manualEventID,
|
||||
SourceVersionNo: 1,
|
||||
SourceKind: "event_bundle",
|
||||
SchemaID: "event-source",
|
||||
SchemaVersion: "1",
|
||||
Status: "active",
|
||||
Notes: &manualSourceNotes,
|
||||
Source: map[string]any{
|
||||
"schemaVersion": "1",
|
||||
"app": map[string]any{
|
||||
"id": "sample-variant-manual-001",
|
||||
"title": "领秀城公园多赛道挑战",
|
||||
},
|
||||
"branding": map[string]any{
|
||||
"tenantCode": "tenant_demo",
|
||||
"entryChannel": "mini-demo",
|
||||
},
|
||||
"map": map[string]any{
|
||||
"tiles": "../map/lxcb-001/tiles/",
|
||||
"mapmeta": "../map/lxcb-001/tiles/meta.json",
|
||||
},
|
||||
"playfield": map[string]any{
|
||||
"kind": "course",
|
||||
"source": map[string]any{
|
||||
"type": "kml",
|
||||
"url": "../kml/lxcb-001/10/c01.kml",
|
||||
},
|
||||
},
|
||||
"game": map[string]any{
|
||||
"mode": "classic-sequential",
|
||||
},
|
||||
"play": map[string]any{
|
||||
"assignmentMode": "manual",
|
||||
"courseVariants": []map[string]any{
|
||||
{
|
||||
"id": "variant_a",
|
||||
"name": "A 线",
|
||||
"description": "短线体验版(c01.kml)",
|
||||
"routeCode": "route-variant-a",
|
||||
"selectable": true,
|
||||
},
|
||||
{
|
||||
"id": "variant_b",
|
||||
"name": "B 线",
|
||||
"description": "长线挑战版(c02.kml)",
|
||||
"routeCode": "route-variant-b",
|
||||
"selectable": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"content": map[string]any{
|
||||
"h5Template": "content-h5-test-template.html",
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo event config source: %w", err)
|
||||
}
|
||||
|
||||
manualBuildLog := "多赛道联调 build 产物"
|
||||
manualBuild, err := s.UpsertEventConfigBuild(ctx, tx, UpsertEventConfigBuildParams{
|
||||
EventID: manualEventID,
|
||||
SourceID: manualSource.ID,
|
||||
BuildNo: 1,
|
||||
BuildStatus: "success",
|
||||
BuildLog: &manualBuildLog,
|
||||
Manifest: map[string]any{
|
||||
"schemaVersion": "1",
|
||||
"releaseId": "rel_demo_variant_manual_001",
|
||||
"version": "2026.04.01",
|
||||
"app": map[string]any{
|
||||
"id": "sample-variant-manual-001",
|
||||
"title": "领秀城公园多赛道挑战",
|
||||
},
|
||||
"map": map[string]any{
|
||||
"tiles": "https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/",
|
||||
"mapmeta": "https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/meta.json",
|
||||
},
|
||||
"playfield": map[string]any{
|
||||
"kind": "course",
|
||||
"source": map[string]any{
|
||||
"type": "kml",
|
||||
"url": "https://oss-mbh5.colormaprun.com/gotomars/kml/lxcb-001/10/c01.kml",
|
||||
},
|
||||
},
|
||||
"game": map[string]any{
|
||||
"mode": "classic-sequential",
|
||||
},
|
||||
"play": map[string]any{
|
||||
"assignmentMode": "manual",
|
||||
"courseVariants": []map[string]any{
|
||||
{
|
||||
"id": "variant_a",
|
||||
"name": "A 线",
|
||||
"description": "短线体验版(c01.kml)",
|
||||
"routeCode": "route-variant-a",
|
||||
"selectable": true,
|
||||
},
|
||||
{
|
||||
"id": "variant_b",
|
||||
"name": "B 线",
|
||||
"description": "长线挑战版(c02.kml)",
|
||||
"routeCode": "route-variant-b",
|
||||
"selectable": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"assets": map[string]any{
|
||||
"contentHtml": "https://oss-mbh5.colormaprun.com/gotomars/event/content-h5-test-template.html",
|
||||
},
|
||||
},
|
||||
AssetIndex: []map[string]any{
|
||||
{"assetType": "manifest", "assetKey": "manifest"},
|
||||
{"assetType": "mapmeta", "assetKey": "mapmeta"},
|
||||
{"assetType": "playfield", "assetKey": "playfield-kml"},
|
||||
{"assetType": "content_html", "assetKey": "content-html"},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo event config build: %w", err)
|
||||
}
|
||||
|
||||
if err := s.AttachBuildToRelease(ctx, tx, manualReleaseRow.ID, manualBuild.ID); err != nil {
|
||||
return nil, fmt.Errorf("attach variant manual demo build to release: %w", err)
|
||||
}
|
||||
|
||||
var manualCourseSetID, manualCourseSetPublicID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO course_sets (
|
||||
course_set_public_id, place_id, map_asset_id, code, mode, name, status
|
||||
)
|
||||
VALUES (
|
||||
'cset_demo_variant_manual_001', $1, $2, 'cset-demo-variant-manual-001', 'classic-sequential', '多赛道挑战赛道集', 'active'
|
||||
)
|
||||
ON CONFLICT (code) DO UPDATE SET
|
||||
place_id = EXCLUDED.place_id,
|
||||
map_asset_id = EXCLUDED.map_asset_id,
|
||||
mode = EXCLUDED.mode,
|
||||
name = EXCLUDED.name,
|
||||
status = EXCLUDED.status
|
||||
RETURNING id, course_set_public_id
|
||||
`, placeID, mapAssetID).Scan(&manualCourseSetID, &manualCourseSetPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo course set: %w", err)
|
||||
}
|
||||
|
||||
var manualVariantAID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO course_variants (
|
||||
course_variant_public_id, course_set_id, source_id, name, route_code, mode, control_count, status, is_default
|
||||
)
|
||||
VALUES (
|
||||
'cvariant_demo_variant_manual_a', $1, $2, '多赛道 A 线', 'route-variant-a', 'classic-sequential', 8, 'active', false
|
||||
)
|
||||
ON CONFLICT (course_variant_public_id) DO UPDATE SET
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
source_id = EXCLUDED.source_id,
|
||||
name = EXCLUDED.name,
|
||||
route_code = EXCLUDED.route_code,
|
||||
mode = EXCLUDED.mode,
|
||||
control_count = EXCLUDED.control_count,
|
||||
status = EXCLUDED.status,
|
||||
is_default = EXCLUDED.is_default
|
||||
RETURNING id
|
||||
`, manualCourseSetID, courseSourceID).Scan(&manualVariantAID); err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo variant a: %w", err)
|
||||
}
|
||||
|
||||
var manualVariantBID, manualVariantBPublicID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO course_variants (
|
||||
course_variant_public_id, course_set_id, source_id, name, route_code, mode, control_count, status, is_default
|
||||
)
|
||||
VALUES (
|
||||
'cvariant_demo_variant_manual_b', $1, $2, '多赛道 B 线', 'route-variant-b', 'classic-sequential', 10, 'active', true
|
||||
)
|
||||
ON CONFLICT (course_variant_public_id) DO UPDATE SET
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
source_id = EXCLUDED.source_id,
|
||||
name = EXCLUDED.name,
|
||||
route_code = EXCLUDED.route_code,
|
||||
mode = EXCLUDED.mode,
|
||||
control_count = EXCLUDED.control_count,
|
||||
status = EXCLUDED.status,
|
||||
is_default = EXCLUDED.is_default
|
||||
RETURNING id, course_variant_public_id
|
||||
`, manualCourseSetID, courseSourceVariantBID).Scan(&manualVariantBID, &manualVariantBPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo variant b: %w", err)
|
||||
}
|
||||
|
||||
if _, err := tx.Exec(ctx, `
|
||||
UPDATE course_sets
|
||||
SET current_variant_id = $2
|
||||
WHERE id = $1
|
||||
`, manualCourseSetID, manualVariantBID); err != nil {
|
||||
return nil, fmt.Errorf("attach variant manual demo course variant: %w", err)
|
||||
}
|
||||
|
||||
var manualRuntimeBindingID, manualRuntimeBindingPublicID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO map_runtime_bindings (
|
||||
runtime_binding_public_id, event_id, place_id, map_asset_id, tile_release_id, course_set_id, course_variant_id, status, notes
|
||||
)
|
||||
VALUES (
|
||||
'runtime_demo_variant_manual_001', $1, $2, $3, $4, $5, $6, 'active', '多赛道联调运行绑定'
|
||||
)
|
||||
ON CONFLICT (runtime_binding_public_id) DO UPDATE SET
|
||||
event_id = EXCLUDED.event_id,
|
||||
place_id = EXCLUDED.place_id,
|
||||
map_asset_id = EXCLUDED.map_asset_id,
|
||||
tile_release_id = EXCLUDED.tile_release_id,
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
course_variant_id = EXCLUDED.course_variant_id,
|
||||
status = EXCLUDED.status,
|
||||
notes = EXCLUDED.notes
|
||||
RETURNING id, runtime_binding_public_id
|
||||
`, manualEventID, placeID, mapAssetID, tileReleaseID, manualCourseSetID, manualVariantBID).Scan(&manualRuntimeBindingID, &manualRuntimeBindingPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure variant manual demo runtime binding: %w", err)
|
||||
}
|
||||
|
||||
var scoreOEventID string
|
||||
if err := tx.QueryRow(ctx, `
|
||||
INSERT INTO events (
|
||||
tenant_id, event_public_id, slug, display_name, summary, status
|
||||
)
|
||||
VALUES ($1, 'evt_demo_score_o_001', 'demo-score-o-run', 'Demo Score-O Run', '积分赛联调活动', 'active')
|
||||
VALUES ($1, 'evt_demo_score_o_001', 'city-park-score-o', '领秀城公园积分赛', '积分赛联调样例活动', 'active')
|
||||
ON CONFLICT (event_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
slug = EXCLUDED.slug,
|
||||
@@ -681,7 +925,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
'rel_demo_score_o_001',
|
||||
$1,
|
||||
1,
|
||||
'Demo Score-O Config v1',
|
||||
'积分赛联调配置 v1',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/event/score-o.json',
|
||||
'demo-score-o-checksum-001',
|
||||
'route-score-o-001',
|
||||
@@ -707,7 +951,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
return nil, fmt.Errorf("attach score-o demo release: %w", err)
|
||||
}
|
||||
|
||||
scoreOSourceNotes := "demo source config imported from local event sample score-o"
|
||||
scoreOSourceNotes := "积分赛联调 source 配置"
|
||||
scoreOSource, err := s.UpsertEventConfigSource(ctx, tx, UpsertEventConfigSourceParams{
|
||||
EventID: scoreOEventID,
|
||||
SourceVersionNo: 1,
|
||||
@@ -720,7 +964,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
"schemaVersion": "1",
|
||||
"app": map[string]any{
|
||||
"id": "sample-score-o-001",
|
||||
"title": "积分赛示例",
|
||||
"title": "领秀城公园积分赛",
|
||||
},
|
||||
"branding": map[string]any{
|
||||
"tenantCode": "tenant_demo",
|
||||
@@ -749,7 +993,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
return nil, fmt.Errorf("ensure score-o demo event config source: %w", err)
|
||||
}
|
||||
|
||||
scoreOBuildLog := "demo build generated from sample score-o.json"
|
||||
scoreOBuildLog := "积分赛联调 build 产物"
|
||||
scoreOBuild, err := s.UpsertEventConfigBuild(ctx, tx, UpsertEventConfigBuildParams{
|
||||
EventID: scoreOEventID,
|
||||
SourceID: scoreOSource.ID,
|
||||
@@ -762,7 +1006,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
"version": "2026.04.01",
|
||||
"app": map[string]any{
|
||||
"id": "sample-score-o-001",
|
||||
"title": "积分赛示例",
|
||||
"title": "领秀城公园积分赛",
|
||||
},
|
||||
"map": map[string]any{
|
||||
"tiles": "https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/",
|
||||
@@ -810,20 +1054,26 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id,
|
||||
display_slot,
|
||||
display_priority,
|
||||
status
|
||||
status,
|
||||
is_default_experience,
|
||||
starts_at,
|
||||
ends_at
|
||||
)
|
||||
VALUES (
|
||||
'card_demo_score_o_001',
|
||||
$1,
|
||||
$2,
|
||||
'event',
|
||||
'Demo Score-O Run',
|
||||
'积分赛联调入口',
|
||||
'领秀城公园积分赛',
|
||||
'积分赛推荐入口',
|
||||
'https://oss-mbh5.colormaprun.com/gotomars/assets/demo-cover.jpg',
|
||||
$3,
|
||||
'home_primary',
|
||||
98,
|
||||
'active'
|
||||
'active',
|
||||
false,
|
||||
NOW() - INTERVAL '1 day',
|
||||
NOW() + INTERVAL '30 day'
|
||||
)
|
||||
ON CONFLICT (card_public_id) DO UPDATE SET
|
||||
tenant_id = EXCLUDED.tenant_id,
|
||||
@@ -835,7 +1085,10 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
event_id = EXCLUDED.event_id,
|
||||
display_slot = EXCLUDED.display_slot,
|
||||
display_priority = EXCLUDED.display_priority,
|
||||
status = EXCLUDED.status
|
||||
status = EXCLUDED.status,
|
||||
is_default_experience = EXCLUDED.is_default_experience,
|
||||
starts_at = EXCLUDED.starts_at,
|
||||
ends_at = EXCLUDED.ends_at
|
||||
RETURNING card_public_id
|
||||
`, tenantID, channelID, scoreOEventID).Scan(&scoreOCardPublicID); err != nil {
|
||||
return nil, fmt.Errorf("ensure score-o demo card: %w", err)
|
||||
@@ -847,7 +1100,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
course_set_public_id, place_id, map_asset_id, code, mode, name, status
|
||||
)
|
||||
VALUES (
|
||||
'cset_demo_score_o_001', $1, $2, 'cset-demo-score-o-001', 'score-o', 'Demo Score-O Course Set', 'active'
|
||||
'cset_demo_score_o_001', $1, $2, 'cset-demo-score-o-001', 'score-o', '积分赛标准赛道', 'active'
|
||||
)
|
||||
ON CONFLICT (code) DO UPDATE SET
|
||||
place_id = EXCLUDED.place_id,
|
||||
@@ -866,7 +1119,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
course_variant_public_id, course_set_id, source_id, name, route_code, mode, control_count, status, is_default
|
||||
)
|
||||
VALUES (
|
||||
'cvariant_demo_score_o_001', $1, $2, 'Demo Score-O Variant', 'route-score-o-001', 'score-o', 10, 'active', true
|
||||
'cvariant_demo_score_o_001', $1, $2, '积分赛主赛道', 'route-score-o-001', 'score-o', 10, 'active', true
|
||||
)
|
||||
ON CONFLICT (course_variant_public_id) DO UPDATE SET
|
||||
course_set_id = EXCLUDED.course_set_id,
|
||||
@@ -896,7 +1149,7 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
runtime_binding_public_id, event_id, place_id, map_asset_id, tile_release_id, course_set_id, course_variant_id, status, notes
|
||||
)
|
||||
VALUES (
|
||||
'runtime_demo_score_o_001', $1, $2, $3, $4, $5, $6, 'active', 'demo score-o runtime binding'
|
||||
'runtime_demo_score_o_001', $1, $2, $3, $4, $5, $6, 'active', '积分赛联调运行绑定'
|
||||
)
|
||||
ON CONFLICT (runtime_binding_public_id) DO UPDATE SET
|
||||
event_id = EXCLUDED.event_id,
|
||||
@@ -959,6 +1212,11 @@ func (s *Store) EnsureDemoData(ctx context.Context) (*DemoBootstrapSummary, erro
|
||||
VariantManualEventID: "evt_demo_variant_manual_001",
|
||||
VariantManualRelease: manualReleaseRow.PublicID,
|
||||
VariantManualCardID: manualCardPublicID,
|
||||
VariantManualSourceID: manualSource.ID,
|
||||
VariantManualBuildID: manualBuild.ID,
|
||||
VariantManualCourseSet: manualCourseSetPublicID,
|
||||
VariantManualVariantID: manualVariantBPublicID,
|
||||
VariantManualRuntimeID: manualRuntimeBindingPublicID,
|
||||
CleanedSessionCount: cleanedSessionCount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user