refactor(ops): 运营可配代码统一 ops_ 前缀(模型/表/repo/admin schema·router)
把首页门面数据的「运营可配」部分代码统一加 ops_ 前缀,与运营语义对齐: - 模型 PlatformStatDisplay→OpsStatConfig(表 platform_stat_display→ops_stat_config)、 MarqueeSeed→OpsMarqueeSeed(表 marquee_seed→ops_marquee_seed) - repo platform_stat→ops_stat、marquee→ops_marquee - admin schema/router dashboard_display→ops_stat_config、marquee_seed→ops_marquee_seed(schema 类 Ops*) - 审计 action/target_type 同步成 ops_* - 引用方(models/__init__、admin/main、api/v1/platform)更 import;platform 用户侧门面保留命名 - 迁移 opsrename01 仅改表名(可逆);路由 URL 与 API 文档文件名不变(前端/客户端无感) - 文档:db 文档重命名 + API 文档/索引同步 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
> 所属:Admin 组(前缀 `/admin/api/dashboard-display`) | 鉴权:Admin Bearer(改需 operator/super) | [← 返回 API 索引](./README.md)
|
||||
|
||||
配置客户端首页三个门面数字(帮助用户 / 完成比价 / 累计节省)的展示模式。每个指标可独立选 real/manual/random。用户侧读取见 [platform-stats](./platform-stats.md);表见 [platform_stat_display](../database/platform_stat_display.md)。
|
||||
配置客户端首页三个门面数字(帮助用户 / 完成比价 / 累计节省)的展示模式。每个指标可独立选 real/manual/random。用户侧读取见 [platform-stats](./platform-stats.md);表见 [ops_stat_config](../database/ops_stat_config.md)。
|
||||
|
||||
> **单位约定**:倍率用**千分比整数**(1.000→`1000`、1.100→`1100`)。`total_saved` 的 `manual_value` / `random_current` / `random_initial` / `random_step_min` / `random_step_max` / `real_offset` 单位都是**分**(前端展示时 ÷100 取元);两个计数指标是个数。
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
## GET /admin/api/dashboard-display — 三指标配置 + 真实值预览
|
||||
|
||||
### 出参
|
||||
响应 `200`:`list[PlatformStatItemOut]`(按 help_users / total_compares / total_saved 顺序)
|
||||
响应 `200`:`list[OpsStatItemOut]`(按 help_users / total_compares / total_saved 顺序)
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
`metric` 路径参数取 `help_users` / `total_compares` / `total_saved`。
|
||||
|
||||
### 入参 `PlatformStatUpdateRequest`(字段均可选,只改传了的)
|
||||
### 入参 `OpsStatUpdateRequest`(字段均可选,只改传了的)
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `mode` | string | `real` / `manual` / `random` |
|
||||
@@ -58,7 +58,7 @@
|
||||
| `apply_now` | bool | 立即更新:不等更新钟点,保存后马上刷新一次(random 走一档,real/manual 取应有值,均经护栏) |
|
||||
|
||||
### 出参
|
||||
响应 `200`:更新后的 `PlatformStatItemOut`(同上)。
|
||||
响应 `200`:更新后的 `OpsStatItemOut`(同上)。
|
||||
|
||||
### 错误
|
||||
- `400`:mode/kind 非法 / 倍率越界(<1000 或 >1500)/ 上限<下限 / 增量负值或上限<下限 / 偏移负值 / tick<60 / 更新时间越界 / manual 负值。
|
||||
@@ -69,5 +69,5 @@
|
||||
- **统一定时刷新**:三模式的展示值(`random_current`)只在「更新时间(按更新间隔)」对齐的北京钟点刷新一次——real 快照查库(+偏移)/ manual 取固定值 / random 按 `random_kind` 走一档(`mult` ×倍率 / `add` +增量)。`random_tick_seconds`+`random_anchor_minutes` 三模式通用。
|
||||
- **只增不减护栏**(`allow_decrease=false`,默认):real/manual 刷新时新目标值低于当前展示值则保持不降;要下调须显式传 `allow_decrease=true`。
|
||||
- 改 mode/manual/倍率/增量/偏移等到**下个更新钟点**才在客户端生效(展示值不立即变);`random_initial` 立即设起点并重置;`apply_now=true` 立即刷新一次。首次无展示值时按当前模式播种。
|
||||
- 每次改动写 `admin_audit_log`(action=`dashboard_display.set`,detail 含改前/改后快照)。
|
||||
- 每次改动写 `admin_audit_log`(action=`ops_stat_config.set`,detail 含改前/改后快照)。
|
||||
- 客户端在**进首页 / 回前台时**重拉 `/stats` 取最新展示值。
|
||||
|
||||
Reference in New Issue
Block a user