文档版本:v1.25 最后更新:2026-04-03 18:56:46
参考 .env.example。
当前最关键的变量:
APP_ENVHTTP_ADDRDATABASE_URLJWT_ACCESS_SECRETAUTH_SMS_PROVIDERAUTH_DEV_SMS_CODEWECHAT_MINI_APP_IDWECHAT_MINI_APP_SECRETWECHAT_MINI_DEV_PREFIXLOCAL_EVENT_DIRASSET_BASE_URLASSET_PUBLIC_BASE_URLASSET_BUCKET_ROOTOSSUTIL_PATHOSSUTIL_CONFIG_FILEcd D:\dev\cmr-mini\backend
.\start-backend.ps1
如果你想固定跑开发工作台常用端口 18090,直接执行:
cd D:\dev\cmr-mini\backend
.\scripts\start-dev.ps1
Bootstrap DemoUse Classic Demo / Use Score-O Demo / Use Manual Variant Demo整条链一键验收event / release / source / build,还会自动切换:
presentation schemacontent manifestasset manifestexample.com 占位地址:
GET /dev/demo-assets/presentations/{demoKey}GET /dev/demo-assets/content-manifests/{demoKey}POST /dev/client-logs前端调试日志 面板里查看当前 Launch 实际配置摘要configUrlreleaseIdmanifestUrlschemaVersionplayfield.kindgame.modelaunch.config.configUrl 或 launch.resolvedRelease.manifestUrl前端调试日志 也是调试专用能力:
Bootstrap Demo 准备出的联调文案也已换成中文样例:
领秀城公园顺序赛领秀城公园积分赛领秀城公园多赛道挑战当前 backend 已为以下入口统一补齐活动卡片最小摘要字段:
/cards/home/me/entry-home当前字段集:
titlesubtitlesummarystatusstatusCodetimeWindowctaTextcoverUrlisDefaultExperienceeventTypecurrentPresentationcurrentContentBundle当前派生规则:
summary
当前暂无活动摘要status
running -> 进行中upcoming -> 即将开始ended -> 已结束状态待确认timeWindow
cards.starts_at / ends_at 派生时间待公布ctaText
进入体验进入活动查看回顾查看详情currentPresentation / currentContentBundle
默认会设置:
APP_ENV=developmentHTTP_ADDR=:18090DATABASE_URL=postgres://postgres:asdf*123@192.168.100.77:5432/cmr20260401?sslmode=disableAUTH_SMS_PROVIDER=consoleWECHAT_MINI_DEV_PREFIX=dev-启动后可直接打开:
当前 workbench 已覆盖两类调试链:
bootstrap -> auth -> entry/home -> event play/launch -> session -> resultmaps/playfields/resource-packs -> admin event source -> build -> publish -> rollbackplaces -> map-assets -> tile-releases -> course-sources -> course-sets -> course-variants -> runtime-bindingsruntimeBinding -> release -> launch.runtimeruntimeBinding -> publish(runtimeBindingId) -> release -> launch.runtimepresentation -> content bundle -> publish(presentationId, contentBundleId, runtimeBindingId) -> releaseevent detail / play / launch -> presentation + content bundle 摘要release 摘要闭环 + content bundle importpresentation import -> event 默认 active 绑定 -> publish 空参继承一键默认绑定发布 与 一键补齐 Runtime 并发布/dev/bootstrap-demo 现在也会回填最小生产骨架:place / map asset / tile release / course source / course set / course variant / runtime binding如果目标是验证“从测试数据准备到 release 继承是否完整”,优先使用 workbench 的一键流,而不是手工逐个点按钮。
当前推荐顺序:
Bootstrap Demo(只准备数据)Use Classic DemoUse Score-O DemoUse Manual Variant DemoBootstrap + 发布当前玩法一键补齐 Runtime 并发布一键标准回归当前这几个按钮的职责已经拆开:
Bootstrap Demo(只准备数据)
Bootstrap + 发布当前玩法
Bootstrap Demo一键补齐 Runtime 并发布
当前这条一键链会自动完成:
placemap assettile releasecourse sourcecourse setcourse variantruntime bindingplay / launch / result / history 回归汇总launched / running session 自动改成 cancelledCourseSource.fileUrl 当前已切到真实 KML:https://oss-mbh5.colormaprun.com/gotomars/kml/lxcb-001/10/c01.kmlhttps://oss-mbh5.colormaprun.com/gotomars/kml/lxcb-001/10/c02.kmlTileRelease.tileBaseUrl / metaUrl 当前已切到真实地图资源:https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/https://oss-mbh5.colormaprun.com/gotomars/map/lxcb-001/tiles/meta.jsonvariant_a -> c01.kmlvariant_b -> c02.kmlevt_demo_001 -> rel_demo_001 -> classic-sequential.jsonevt_demo_score_o_001 -> rel_demo_score_o_001 -> score-o.jsonevt_demo_variant_manual_001 -> rel_demo_variant_manual_001当前日志能力:
Release IDPresentationContent BundleRuntime Binding判定发布链PlayLaunchResultHistorySession ID总判定拉取前端日志清空前端日志eventIdreleaseIdsessionIdmanifestUrlroutegame.modeplayfield.kinddev 环境下,frontend 可直接把关键调试事实发到 backend:
POST /dev/client-logs建议请求体最少包含:
{
"source": "miniprogram",
"level": "info",
"category": "runtime",
"message": "map page loaded manifest",
"eventId": "evt_demo_score_o_001",
"releaseId": "rel_xxx",
"sessionId": "sess_xxx",
"manifestUrl": "https://oss-mbh5.colormaprun.com/...",
"route": "pages/map/map",
"occurredAt": "2026-04-03T16:16:38+08:00",
"details": {
"schemaVersion": "1",
"playfield.kind": "control-set",
"game.mode": "score-o",
"phase": "map-init"
}
}
当前说明:
source:建议填终端来源,例如 miniprogramlevel:建议填 info / warn / errorcategory:建议填 launch / runtime / cache / networkmessage:一句话说明当前发生了什么details:放结构化调试细节,backend 原样收下辅助接口:
GET /dev/client-logs?limit=50DELETE /dev/client-logs当前要明确一条玩家链路规则:
当前接口中的:
currentPresentationcurrentContentBundle在玩家链路里表示的是:
不是:
所以如果当前 release 还没绑定这些对象,玩家页看到空值是正常行为。前端页面应优先:
play.canLaunch 判定是否允许进入当前 canLaunch 已按正式进入规则收紧:
play.canLaunch = true
status = activemanifestruntimepresentationcontent bundle当前 POST /events/{eventPublicID}/launch 也已与 canLaunch 保持同一套前置条件。
当前第一版全部依赖:
Redis 后面只在需要性能优化、限流或短期票据缓存时再接。
当前默认可走 console provider。
用途:
当前支持 dev- 前缀 code。
适合:
当前支持从根目录 event 导入本地配置文件。
相关环境变量:
LOCAL_EVENT_DIRASSET_BASE_URL作用:
LOCAL_EVENT_DIR 决定本地 source config 从哪里读ASSET_BASE_URL 决定 preview build 时如何把相对资源路径归一化成可运行 URLASSET_PUBLIC_BASE_URL 决定 publish 时如何把公开 URL 映射到 OSS 对象 keyASSET_BUCKET_ROOT 决定发布对象上传到哪个 bucket 根路径OSSUTIL_PATH 和 OSSUTIL_CONFIG_FILE 决定 backend 发布 manifest 时使用哪个 OSS 客户端当前 migration 文件在 migrations。
执行原则:
POST /dev/bootstrap-demo它会保证 demo 数据存在:
tenant_demomini-demoevt_demo_001rel_demo_001card_demo_001GET /dev/workbench这是当前最重要的联调工具。
可以直接测试:
补充说明:
publish build 现在会真实上传 manifest.json 和 asset-index.json 到 OSSSave Event Defaults 会把当前 event 的默认 active 绑定写入:
currentPresentationIdcurrentContentBundleIdcurrentRuntimeBindingIdPublish Build 如果不显式填写这三项,会优先继承 event 默认 active 绑定并且支持:
当前第一阶段生产骨架联调台只做:
listcreatedetailbinding明确不做:
editdeletebatch活动运营域第二阶段当前也只做最小动作:
listcreatedetailpublish 绑定importbootstrap-demologin/wechat-minime/entry-homeevents/{id}/playevents/{id}/launchsessions/{id}/startsessions/{id}/finishsessions/{id}/resultauth/sms/sendauth/login/smsme/entry-homelaunchsessionresultlogin/wechat-miniauth/sms/send with scene=bind_mobileauth/bind/mobileme/profilebootstrap-demodev/events/{eventPublicID}/config-sources/import-localdev/config-builds/previewdev/config-builds/publishevents/{id}events/{id}/launch在 /dev/workbench 的 后台运营 模式中,按下面顺序操作:
List Places 或 Create PlacePlace 下 Create Map AssetMapAsset 下 Create Tile ReleaseCreate Course SourceMapAsset 下 Create Course SetCourseSet 下 Create VariantCreate Runtime Binding成功后应能拿到这些 ID:
placeIdmapAssetIdtileReleaseIdcourseSourceIdcourseSetIdcourseVariantIdruntimeBindingId建议第一次联调时用这组最小规则:
Place 先建 1 个Place 先只建 1 个 MapAssetMapAsset 先只建 1 个 TileReleaseCourseSet 先只建 1 个默认 CourseVariantRuntimeBinding 先只绑定当前正在验证的 Event这条链当前只验证对象关系闭环,不验证:
launch 返回运行对象字段EventPresentationContentBundle在 /dev/workbench 的 后台运营 模式中,先完成“场景五”,再按下面顺序操作:
Get PipelineRelease IDRuntime Binding IDBind RuntimeGet Release前台联调event 执行 Launch在 /dev/workbench 的 后台运营 模式中,按下面顺序操作:
Get EventCreate PresentationCreate BundleAssemble SourceBuild SourceRuntime Binding IDPresentation IDContent Bundle IDPublish BuildGet Release成功后应能在 release 返回中看到:
runtimepresentationcontentBundle并且这 3 类绑定当前都已固化到 event_release。
成功后应能看到:
GET /admin/releases/{releasePublicID} 返回 runtimePOST /events/{eventPublicID}/launch 返回 launch.runtime当前阶段的约束是:
runtime 字段块resolvedReleasebusinessvariantruntimeBindingId,则 launch.runtime 为空在 /dev/workbench 的 后台运营 模式中,先完成“场景七”,再按下面顺序操作:
Create Presentation 或直接复用现有 Presentation IDImport BundleGet BundleGet PipelinePublish BuildGet Release前台联调Event DetailEvent PlayLaunch成功后应能同时看到这三组摘要:
release.presentation.templateKey / versionrelease.contentBundle.bundleType / versionrelease.runtime.placeId / mapId / tileReleaseId / courseVariantId同时客户端消费侧应保持一致:
GET /events/{eventPublicID}GET /events/{eventPublicID}/playPOST /events/{eventPublicID}/launch当前 Content Bundle Import 只做统一导入入口,不做复杂资源平台:
titlebundleTypesourceTypemanifestUrlversionassetManifestbundleIdbundleTypeversionassetManifeststatus在 /dev/workbench 的 后台运营 模式中,先完成“场景五”,再按下面顺序操作:
Create Runtime BindingGet PipelineBuild IDRuntime Binding IDPublish BuildGet Release前台联调event 执行 Launch成功后应能看到:
POST /admin/builds/{buildID}/publish 返回带 runtimeGET /admin/releases/{releasePublicID} 返回同一条 runtimePOST /events/{eventPublicID}/launch 返回同一条 launch.runtime当前第四刀的兼容要求是:
publish,再 bind runtime”路径继续可用publish 时直接传 runtimeBindingId”优先推荐resolvedReleasebusinessvariant文档整理完之后,后面建议按这个顺序继续:
play context -> launch 模型不要跳回去把玩法规则塞进 backend。