按反馈是**增加**而不是**替换**:旧路径一行未动,新路径另起一条。 ## 两套来源并存 | | 手动输入(旧,默认) | 选择账号(新) | | --- | --- | --- | | 来源 | 粘贴文本 | 库里账号的凭据(不用人工粘贴) | | 条目 `account_id` | **无** | 有 | | 结果落账号时间线 | **否**(保持旧行为) | 是,新事件类型 `account_check` | | 批次 / 并发 / 重试 / 代理 / 导出 zip | 完全不变 | 完全不变 | **旧路径的「不发事件」是刻意的**:粘贴进来的账号没有归属,凭空造一条没有账号的 事件只是污染时间线。`parse_account_check_lines`、`export_line`、zip 分组全部未动, 有用例专门钉住这一点。 ## 「选择账号」支持筛选(按反馈补充) 不是给一个扁平下拉,而是先按条件缩小范围再决定选法: - 筛选:**标签 / 生命周期状态 / CK 健康**(复用账号列表同一套 `_filter_accounts_query`, 两处口径不会不一致) - 选法:手动多选(选项随筛选刷新)**或**「按筛选全选」(含列表里没显示出来的) 服务端支持 `select_all_matching + 各筛选条件`,与账号列表批量操作的字段形状一致。 可见性沿用账号域口径:客服只能检测自己名下的账号(越权 id 直接 403)。 ## 结果表加账号回链 「选择账号」模式下条目带 `account_id`,账号列变成可点链接 → 直接跳到账号详情, 结果也在那里的时间线上。 ## 排查中修掉两个 bug(都不是测试发现的) **① `registry.create` 漏传 `account_id`** 它构造 `AccountCheckItemState` 时没把 `account_id` 从输入复制过去。 后果:批次照跑、结果照显示、zip 照导出,**事件永远不发且没有任何报错**。 是「跑一次真实检测再查事件表」才发现的(查出来 0 条)。已补,并加了用例。 **② 终态判断写成「键存在」而不是「非空」** `_run_one` 置 `running` 时会显式传 `finished_at=None`,而判断写的是 `"finished_at" in updates` → **中间态也发事件**,于是时间线上记的是 `账号检查:running`;真正的终态再发时撞同一个幂等键被**静默丢弃** —— 结果是「只有一条,但记错了」,比没有更糟。 改成判非空。此处暴露了一个**假绿的用例**:我原来的「中间态不发事件」用例 没传 `finished_at=None`(与真实调用不一致),所以放过了这个 bug; 而且它还缺 `session.commit()`,在 MySQL REPEATABLE READ 下根本看不到 另一个会话刚提交的行 —— 双重假绿。两处都修了,并做了反向验证 (改回旧判断 → 用例立刻红)。 ## 验证 - `TZ=Asia/Shanghai`:**520 passed / 6 skipped**(新增 17 条检测模式用例) - `TZ=UTC`(检测 + 迁移)20 passed;ruff 全绿;前端 build 通过、lint 0 errors - **真实端到端**:用真实库账号起批次 → 检测跑完(斗鱼返回「账号已认证」)→ 事件确实落库;清掉脏数据后用**与 `_run_one` 完全相同的调用序列**复验: 两次 `_set_item` 只产生一条事件,且 title 是 `账号检测:账号已认证`、`status=account_verified`(不再记成 running) 注:验证时真实触发了几次斗鱼登录检测(开发库那两个账号),结果都是「已认证」。
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])