模板市集与上架
模板市集子平台(pa/templates)是模板的分发中心:所有应用可见/可安装任意模板,每个应用同一时间只有一个激活模板。
生命周期
draft → submit → review → approved → (online) ← 审核流
↓ rejected
draft(可修改再提交)
状态:draft 草稿 → review 待审 → approved 已通过(官方)→ offline 下架。
模板管理 API
# 创建模板
POST /templates/v1/templates
body: { code, name, category, version, template: {...}, seed: {...}, ... }
# 提交审核
POST /templates/v1/templates/{code}/submit
# 审核(运营)
POST /templates/v1/templates/{code}/approve body: { verified: true }
POST /templates/v1/templates/{code}/reject body: { comment }
# 公开市场列表(无需登录)
GET /templates/v1/templates?lang=cn&category=audio&free=1
安装 / 激活 / 回滚
# 安装到应用(预览态)
POST /templates/v1/templates/{code}/install body: { appid }
# 激活(自动撤销该应用其他激活模板)
POST /templates/v1/templates/{code}/activate body: { appid }
# 回滚到安装前
POST /templates/v1/templates/{code}/rollback body: { appid }
安装时校验数据契约:
requires里的 scope 目标应用必须已授权,否则返回409 CONTRACT_UNSATISFIED;- 安装 = 备份模板层配置 → 写 page_blocks/theme/settings → 预览 → 激活;
- 数据层永不因切模板而变。
提交一个好模板的检查清单
- [ ]
pages至少一个页面,区块使用通用类型 - [ ]
requires精确声明依赖 scope - [ ] 8 语言名称与描述齐全
- [ ] 缩略图(
thumbnail_url)与演示地址(demo_url)可用 - [ ]
seed仅含演示数据,不预置正式内容 - [ ] 价格合理(积分),免费模板建议
price=0