文档版本:v1.14 最后更新:2026-04-03 20:10:25
参考 .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
默认会设置:
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一键补齐 Runtime 并发布一键标准回归当前这条一键链会自动完成:
placemap assettile releasecourse sourcecourse setcourse variantruntime bindingplay / launch / result / history 回归汇总launched / running session 自动改成 cancelled当前日志能力:
Release IDPresentationContent BundleRuntime Binding判定发布链PlayLaunchResultHistorySession ID总判定当前第一版全部依赖:
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。