补充方案

This commit is contained in:
not-like-juvenile
2026-03-12 10:36:51 +08:00
parent 9cc6dcc2a6
commit 4acbb8ced5
7 changed files with 290 additions and 18 deletions

View File

@@ -86,6 +86,13 @@
- `NOTIFY_WORKER_SUPA_USE_BEARER`(可选,默认 false仅对 notify-worker 生效,若为 `true` 则发送 `Authorization: Bearer <SUPA_KEY>`
- `SUPA_USE_BEARER`(可选,默认 false全局开关会影响其它服务一般不建议在自托管 JWT_SECRET 不一致时开启)
RLS 开启且 Bearer/JWT 不可用时的替代方案(慎用/止血):
- `NOTIFY_WORKER_USE_RLS_SAFE_RPC`(可选,默认 false若为 `true`,则不再直查 `ml_orders`,改为调用 `rpc/notify_get_order_recipients`SECURITY DEFINER获取 `user_id/merchant_id`
- `NOTIFY_WORKER_RPC_TOKEN`(当上面为 true 时必需notify-worker 调用 RPC 时通过请求头 `x-notify-worker-token` 传递;数据库函数会校验该 token。
配套 SQL
- `pages/mall/delivery/doc/需求文档/db/绕过RLS的方案(慎用)/20260311_add_rpc_notify_get_order_recipients.sql`
worker 行为:
- `NOTIFY_WORKER_POLL_MS`(默认 2000
- `NOTIFY_WORKER_BATCH_SIZE`(默认 20