docs(plans): 记录 K16 注册限流后台配置回执
This commit is contained in:
1 parent
1493fce319
commit
c1c3c1ce9a
2 files changed
+163
-1
No files matched your search
@@ -2986,6 +2986,148 @@ c4694c6 fix(flutter): 增加首页服务器设置并更新真机默认地址
|
||||
|
||||
---
|
||||
|
||||
## 2026-10-17 K16 注册限流后台配置化
|
||||
|
||||
### 32.1 最终口径
|
||||
|
||||
叙述:K16 开工后 Trae 于 `461fb8e` 更新任务书,要求从 `sys_config` 读取配置,
|
||||
不使用 `application.yml` 固化。初版 `@Value` 实现已按最新口径修正。
|
||||
|
||||
最终配置键:
|
||||
|
||||
```text
|
||||
app.register.max-per-ip-per-day
|
||||
app.register.max-per-device-per-day
|
||||
```
|
||||
|
||||
- 值 <= 0:对应维度不限制;
|
||||
- 键缺失或非整数:回退 IP 5 / 设备 3;
|
||||
- 错误码和错误文案不变。
|
||||
|
||||
### 32.2 后端实现与测试
|
||||
|
||||
`AppAuthService` 注入 `ConfigService`,module-user 增加 module-system 依赖。
|
||||
首次红灯:
|
||||
|
||||
```text
|
||||
Could not find field 'maxRegisterPerIpPerDay'
|
||||
Tests run: 16, Failures: 0, Errors: 4
|
||||
```
|
||||
|
||||
最终定向测试:
|
||||
|
||||
```text
|
||||
$ mvn -pl fruitshorts-app-api -am -Dtest=AppAuthServiceTest -Dsurefire.failIfNoSpecifiedTests=false test
|
||||
Tests run: 18, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
```
|
||||
|
||||
覆盖:IP 超限、设备超限、自定义阈值、IP=0、设备=0、缺省回退、非数字回退。
|
||||
|
||||
全量测试:
|
||||
|
||||
```text
|
||||
$ mvn test
|
||||
[INFO] BUILD SUCCESS
|
||||
```
|
||||
|
||||
### 32.3 种子配置与后台页面
|
||||
|
||||
`sql/data-phase1.sql` 增加幂等种子:
|
||||
|
||||
```sql
|
||||
INSERT INTO sys_config (id, config_key, config_value, remark) VALUES
|
||||
(3, 'app.register.max-per-ip-per-day', '0', '0=不限制;生产建议 5'),
|
||||
(4, 'app.register.max-per-device-per-day', '0', '0=不限制;生产建议 3')
|
||||
ON CONFLICT (config_key) DO NOTHING;
|
||||
```
|
||||
|
||||
当前开发库执行结果:
|
||||
|
||||
```text
|
||||
INSERT 0 2
|
||||
id | config_key | config_value | remark
|
||||
----+-------------------------------------+--------------+--------------------
|
||||
3 | app.register.max-per-ip-per-day | 0 | 0=不限制;生产建议 5
|
||||
4 | app.register.max-per-device-per-day | 0 | 0=不限制;生产建议 3
|
||||
```
|
||||
|
||||
后台 `SettingsView.vue` 原有页面只显示两个旧配置字段,因此补充了两个数值项,
|
||||
沿用现有 `/admin/configs` 接口,不新建页面。
|
||||
|
||||
```text
|
||||
$ pnpm build:pro
|
||||
Build successful. Please see dist-pro directory
|
||||
```
|
||||
|
||||
Web 提交 `54db082`,合并 `5c087f4`,已推送。
|
||||
|
||||
### 32.4 打包、重启与接口自检
|
||||
|
||||
```text
|
||||
$ mvn -pl fruitshorts-app-api -am package -DskipTests
|
||||
[INFO] BUILD SUCCESS
|
||||
```
|
||||
|
||||
旧 8081 服务停止后,通过 `launchctl` 启动新 jar。当前服务:
|
||||
|
||||
```text
|
||||
80642 0 com.fruitshorts.app-api
|
||||
java 80642 ... TCP *:8081 (LISTEN)
|
||||
```
|
||||
|
||||
健康检查:
|
||||
|
||||
```text
|
||||
HTTP/1.1 200
|
||||
{"code":0,"message":"ok","data":{"status":"UP","app":"fruitshorts-app-api",...}}
|
||||
```
|
||||
|
||||
同一新设备号连续注册 4 次(令牌字段已省略):
|
||||
|
||||
```text
|
||||
attempt 1 HTTP 200 {"code":0,"message":"ok","newUser":true,"uid":"U-4JA-DDD"}
|
||||
attempt 2 HTTP 200 {"code":0,"message":"ok","newUser":true,"uid":"UTIOUCLLV"}
|
||||
attempt 3 HTTP 200 {"code":0,"message":"ok","newUser":true,"uid":"UR6ZJRO74"}
|
||||
attempt 4 HTTP 200 {"code":0,"message":"ok","newUser":true,"uid":"UXJF6MECJ"}
|
||||
```
|
||||
|
||||
解读:开发库两键均为 0,IP 与设备 guard 均跳过,连续注册不再 429。
|
||||
|
||||
### 32.5 Git
|
||||
|
||||
```text
|
||||
FruitServer:
|
||||
3403a52 docs(plans): 增加 K16 注册限流配置化计划
|
||||
758eb69 feat(backend): 注册限流阈值改为可配置
|
||||
f1aaaee fix(backend): 改为后台配置注册限流阈值
|
||||
f4003ed test(backend): 覆盖注册限流缺省回退
|
||||
5b7be2e merge: 合并注册限流缺省回退测试
|
||||
78fb995..5b7be2e develop -> develop
|
||||
|
||||
ReelShortWeb:
|
||||
54db082 feat(admin): 增加注册限流配置项
|
||||
5c087f4 chore(admin): 合并注册限流配置项
|
||||
3ec9ea6..5c087f4 develop -> develop
|
||||
```
|
||||
|
||||
最终后端修正与 Web 提交的 author/committer 均为
|
||||
`Zhou Weidong <502333560@qq.com>`。
|
||||
|
||||
### 32.6 用户验收步骤
|
||||
|
||||
1. 登录后台「系统设置」。
|
||||
预期:看到注册频控两个数值项,当前均为 0。
|
||||
2. 将单设备上限改为 3,保存后使用同一设备注册第 4 次。
|
||||
预期:返回 429;恢复 0 后第 4 次可成功。
|
||||
3. 将单 IP 上限改为 1,保存后从同一 IP 注册第 2 次。
|
||||
预期:返回 429;恢复 0 后恢复不限。
|
||||
4. 验证完成后开发库恢复 0/0;生产配置建议恢复 IP 5 / 设备 3。
|
||||
|
||||
设备侧接口结果与后台截图由用户最终验收。
|
||||
|
||||
---
|
||||
|
||||
## 2026-10-17 iOS 构建阻塞:固定 shared_preferences_foundation 2.5.6
|
||||
|
||||
### 25.1 现象与根因
|
||||
|
||||
Reference in new issue
Block a user