S4-D1/D2: C1 回调推送引擎+C2 上行自动拉黑——验收项「死信可查/拒收即拉黑」✅: ①C1=callback_task 队列表(迁移 v21,状态机 pending→sent/dead+attempt/next_retry_at/last_code)+PushWorker(2s 扫/批 100/并发 8/2^n 秒指数退避封顶 10min/10 次耗尽死信/UPDATE CAS 防竞态)+双挂点(report 终态首锁[Consumer+PairService,与 CMPP Deliver 同点同语义]+uplink 消费尾)+URL 门控 account_config.report_url/uplink_url(60s TTL 缓存,未配置零任务)+GET /ops/callback(列表+状态计数面板)/POST /ops/callback/:id/resend(casbin ops callback:read/write v21 所种)+前端回调管理页(ops-callback 路由系统管理组+api/callback.ts+状态面板/筛选/载荷展开/死信重派;matrix+guard 33 菜单显式更)+metrics callback_push_total{type,result}/blacklist_total+openapi v1.4.0;②C2=AutoBlacklister 等值词表(trim+lower 防误伤,默认 R/TD/退订/拒收;SystemConfig uplink.blacklist.keywords 可配 60s 刷新)→policy_blacklist(source=2/账号级/uk 幂等)+Redis Set 即时生效,拉黑不影响上行推送(需求原文);③真机全链六步实证(dev 中间件):回执 DELIVRD→detail 终态→HTTP 回调 JSON 送达(200/sent)+上行 R→拉黑(source=2+Redis=1)+推送送达+坏 URL→attempt10→dead→resend ISC:000→修复重投 sent+status_counts 面板;一次性探针 cmd/cbprobe 用后即删+冒烟数据全清;④单测 +13(callback 6[入队门控/载荷/状态机全链/并发批]+uplink 5[词表/配置覆盖/幂等缓存/消费链]+report 2[首锁一次/nil]);⑤门禁=build/vet/-race 40 包/lint 0/eslint0/vue-tsc0/vitest 148/build 全绿;迁移测试 v15..v21 两遍幂等+dev 实跑 v21;gofmt 存量 8 文件顺手清零(S2 遗留);⑥口径诚实标注:载荷无签名挂账/拦截终态 HTTP 未挂(CMPP 侧已有)/PushWorker 单实例 at-least-once;验收单 s4-d1d2-callback.md+CHANGELOG+memory-bank 回填
ci / test (push) Canceled after 0s
ci / web-test (push) Canceled after 0s
ci / build (push) Canceled after 0s
ci / deploy-dev (push) Canceled after 0s

This commit is contained in:
2026-11-16 11:19:55 +08:00
parent 4e7f77a41a
commit bb60d60529
36 changed files with 1544 additions and 52 deletions
+24 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: go-sms API v1(阶段 2:账号与权限)
version: 1.3.0
version: 1.4.0
description: |
阶段 2(Day 21-30)交付的账号与权限域全部端点。
统一响应 {code,msg,data}:code=ISC:000 成功;错误码三位制(ISC:4xx/5xx)。
@@ -986,6 +986,29 @@ paths:
application/json:
schema: {type: object, properties: {date: {type: string, format: date, description: 可回补历史日期(明细热窗内)}}}
responses: {"200": {description: "落账行数(账号/通道两表)"}}
/ops/callback:
get:
tags: [callback]
summary: 回调推送任务列表(S4·C1;死信可查;status 0待推送/1已送达/2死信,ops)
parameters:
- {name: status, in: query, schema: {type: integer, enum: [0, 1, 2]}, description: 缺省=全部}
- {name: type, in: query, schema: {type: integer, enum: [1, 2]}, description: "1回执终态 2上行消息;缺省=全部"}
- {name: account_id, in: query, schema: {type: integer}}
- {name: page, in: query, schema: {type: integer, default: 1}}
- {name: page_size, in: query, schema: {type: integer, default: 20}}
responses:
"200":
description: "{total,list[],status_counts{pending,sent,dead}}"
/ops/callback/{id}/resend:
post:
tags: [callback]
summary: 死信重派(status 2→0/attempt 清零/立即投递;仅死信可派,幂等拒绝非死信,ops)
parameters:
- {name: id, in: path, required: true, schema: {type: integer}}
responses:
"200": {description: "{id,resent:true}"}
"404": {description: "任务不存在或非死信状态(ISC:404)"}
components:
securitySchemes:
bearerAuth: {type: http, scheme: bearer, bearerFormat: JWT}