运营公告
基址 https://admin.auroran.io。公开读无鉴权;管理写要 Bearer。
一条公告(id)可有多语言版本,各语言独立发布,互不 fallback。
客户端必须显式传 locale(省略默认 zh)。
locale | 语言 |
|---|---|
zh | 中文 |
en | English |
ja | 日本語 |
ko | 한국어 |
vi | Tiếng Việt |
th | ไทย |
category | 含义 | 列表别名 |
|---|---|---|
listing | 上币 | listings |
delisting | 下架 | delistings |
update | 更新 | updates |
status:draft · published · archived。
公开接口只返回该 locale 已发布且已到点(published_at_ms 为空或 ≤ now)且 title 非空的版本。
排序:sort_weight 降序 → 该 locale published_at_ms 降序 → 公告 created_at_ms 降序。
cover_image_url 可能是 https://… 外链,或相对路径
/api/public/assets/announcements/{filename}(拼基址后使用)。
交易站浏览器前缀:/announcements-api/* → /api/public/*。
公开只读
GET /api/public/announcements
| Query | 默认 | 说明 |
|---|---|---|
locale | zh | 语言 |
category | 全部 | all / 省略不筛;或上表值 / 别名 |
offset | 0 | 分页 |
limit | 见下 | 最大 100 |
无 query string 时 limit=20;有 query 但未传 limit 时 limit=50。
200:
{
"announcements": [{
"id": "a1b2c3d4e5f6789012345678abcdef01",
"category": "listing",
"locale": "en",
"title": "New listing: BTC-USDC perps",
"summary": "…",
"body": "Markdown…",
"cover_image_url": "/api/public/assets/announcements/a1b2c3d4.jpg",
"published_at_ms": 1719000000000,
"sort_weight": 0
}],
"offset": 0,
"limit": 20,
"total": 1,
"locale": "en"
}
公开响应不含 status / created_by 等管理字段。非法 locale / category → 400;无库 → 503。
GET /api/public/announcements/{id}
Query:locale(默认 zh)。返回单个公开对象(含完整 body)。
该语言未发布 / 未到点 / id 不存在 → 404。
GET /api/public/announcements/{id}/locales
{ "id": "…", "locales": ["en", "ko", "zh"] }
id 存在但尚无已发布语言时 locales 为空数组(仍 200)。
GET /api/public/assets/announcements/{filename}
上传图。filename 仅允许字母数字、.、-、_。
Content-Type 为 jpeg/png/webp/gif;Cache-Control: public, max-age=86400。
非法或不存在 → 404。
管理(Bearer)
GET /api/announcements
含草稿 / 归档。Query:category、status、locale(默认 zh,决定列表行展示哪一语言)、offset、limit(默认 50)。
200: { "announcements": [AnnouncementListItem], "offset", "limit", "total", "locale" }
列表行含元数据 + 该 locale 的 title/summary/status,以及 locale_summaries[]。
GET /api/announcements/{id}
详情:元数据 + locales[](全部语言,含草稿)。不存在 → 404。
POST /api/announcements
Body: { "category": "listing", "primary_locale"?: "zh", "sort_weight"?: 0 }
201: { "ok": true, "announcement": <详情> }
PUT /api/announcements/{id}
更新元数据(不含正文)。Body: { "category"?, "primary_locale"?, "sort_weight"? }
PUT /api/announcements/{id}/locales/{locale}
按语言 upsert。非法 locale → 400。
Body:
{
"title": "…",
"summary": "…",
"body": "Markdown…",
"cover_image_url": "/api/public/assets/announcements/….jpg",
"status": "published",
"published_at_ms": 1719000000000
}
published_at_ms 为空表示立即(或保持未定时)。
DELETE /api/announcements/{id}/locales/{locale}
删除某一语言版本。
DELETE /api/announcements/{id}
删除整条公告及全部语言。
POST /api/announcements/upload
Content-Type: multipart/form-data,字段名 file。优先传到已配置的 S3;失败则落到本地
/api/public/assets/announcements/…。
200: { "url", "filename", "content_type", "size_bytes", "storage": "s3" | "local" }