- warehouseNotify: 按固定群订阅经 wms_api_app 回调推送(MD5 验签),消息表登记+失败重试 - notice: 货主群缺失时降级发仓库异常群(前缀标记失败),合约停用/已解除货主不发货主群也不降级 - order_async: 订单同步通知 3 分钟去抖合并,Redis 队列+定时冲刷+失败重试 - receiving: 收货完成/驳回/审核通知走仓库通道,仓库/货主侧文案分离 - storage/inventory: 移除移库完成群通知(事件码保留,库存余量提醒仍复用) - 新增 debug:warehouse:push-receiver 调试接收服务与文档/变更记录
152 lines
12 KiB
JSON
152 lines
12 KiB
JSON
[
|
||
{
|
||
"version": "2026.08.01-warehouse-01",
|
||
"date": "2026-08-01",
|
||
"type": "added",
|
||
"summary": "新增 /warehouse 仓库开放 API 入口,支持仓库级外部适配器 HMAC-SHA256 签名鉴权调用,首批上线 index.ping 心跳 + store.list 货主列表",
|
||
"methods": [
|
||
"index.ping",
|
||
"store.list"
|
||
],
|
||
"notes": [
|
||
"POST /warehouse 为新增入口,独立于 /openapi(货主级),鉴权使用 interface_type_id=3 的仓库 API 应用(由 apiApp 模块管理)。",
|
||
"签名算法与 /openapi 完全一致:query 参数字典序 + body 拼接 → HMAC-SHA256 → hex。",
|
||
"时间戳 ±10 分钟有效期,Redis 缓存 API 应用配置 300 秒(缓存前缀 warehouse:api-app)。",
|
||
"无需 StoreWarehouse 合约关联,直接通过 api_app.warehouse_id 确定仓库上下文。",
|
||
"index.ping:无需 body 参数,返回 warehouse_id / app_key / server_time / status。",
|
||
"store.list:分页查询当前仓库下已授权的货主,通过 wms_store_warehouse 关联 wms_store,仅返回 auth_status=2 + store.status=1 + warehouse_use_status=1 的记录。",
|
||
"api_sign.js 改造:getApiAppConfigByAppKey 新增 interfaceTypeId 参数(默认 2 保持向后兼容),warehouse 入口传 3,查询增加 interface_type_id 条件并返回 warehouse_id。"
|
||
],
|
||
"module": "warehouse"
|
||
},
|
||
{
|
||
"version": "2026.08.03-warehouse-01",
|
||
"date": "2026-08-03",
|
||
"type": "added",
|
||
"summary": "新增仓库开放 API 站内信模块 inbox.push,支持外部系统将消息推入仓库站内信,WMS 异步转发到目标渠道(IM/API/webhook)",
|
||
"methods": [
|
||
"inbox.push"
|
||
],
|
||
"notes": [
|
||
"POST /warehouse?method=inbox.push,interface_type_id=3(仓库侧),使用 MD5 签名鉴权",
|
||
"warehouse_id 由验签后上下文注入,禁止外部传入(安全边界)",
|
||
"ext_id 格式:api:{appKey}:{requestId},用于幂等去重",
|
||
"target_url 仅允许 https://,禁止内网 IP(SSRF 防护)",
|
||
"推送 body 大小限制 64KB",
|
||
"异步推送使用 setImmediate,不阻塞响应;失败指数退避重试(30s→60s→120s,最多3次)",
|
||
"路由到 app/service/warehouseMethods/inbox.push → app/service/inbox/receiver.receive"
|
||
],
|
||
"module": "inbox"
|
||
},
|
||
{
|
||
"version": "2026-08-06",
|
||
"date": "2026-08-06",
|
||
"summary": "inbox.push 文档同步代码现状:移除废弃参数 sourceChannel/targetChannel/storeId,补齐缺失参数 groupId/groupName/userId/userName/content,更新错误码与描述",
|
||
"methods": [
|
||
"inbox.push"
|
||
],
|
||
"notes": [
|
||
"移除 sourceChannel / targetChannel / storeId 参数(代码中不存在)",
|
||
"补齐 groupId / groupName / userId / userName / content 参数",
|
||
"移除 targetChannel/targetUrl 相关错误码",
|
||
"新增 parent_id 校验、消息体 64KB 限制错误码",
|
||
"ext_id 自动组合为 api:{appKey}:{requestId}"
|
||
]
|
||
},
|
||
{
|
||
"version": "2026-08-07",
|
||
"date": "2026-08-07",
|
||
"summary": "inbox.push: source_type 硬编码为 api,移除 sourceType 入参(仓库 API 入站来源固定为 api,无需外部传入)",
|
||
"methods": [
|
||
"inbox.push"
|
||
],
|
||
"notes": [
|
||
"source_type 从 body.sourceType || 'api' 改为硬编码 'api'",
|
||
"文档移除 sourceType 参数,description 补注 source_type 固定为 api"
|
||
]
|
||
},
|
||
{
|
||
"version": "2026-08-14-warehouse-01",
|
||
"date": "2026-08-14",
|
||
"type": "changed",
|
||
"summary": "inbox.push 新增 sendTime 参数与历史消息过滤:外部补推的历史消息不再触发 AI 自动处理(防止误建工单)",
|
||
"methods": [
|
||
"inbox.push"
|
||
],
|
||
"notes": [
|
||
"inbox.push 新增可选参数 sendTime:消息原始发送时间(毫秒/秒时间戳或 ISO 字符串),由 warehouseMethods/inbox.js parseSendTime 统一规范化为毫秒",
|
||
"send_time 统一存入 wms_inbox_message.flags.send_time(毫秒),flags.send_time 与 sendTime 参数等价",
|
||
"processor.handleApiMessage 新增历史消息过滤:flags.skipAi=true 或 send_time 距今超过 config.inbox.historyMessageMaxAgeMs(默认 10 分钟)→ 跳过绑群与 AI 处理,不自动回复、不创建工单",
|
||
"未传 sendTime 的消息按实时消息处理,保持向后兼容",
|
||
"过滤点位于屏蔽检查之后、绑群码识别之前,仅拦截自动处理链路"
|
||
],
|
||
"module": "inbox"
|
||
},
|
||
{
|
||
"version": "2026-08-16-warehouse-01",
|
||
"date": "2026-08-16",
|
||
"type": "changed",
|
||
"summary": "统一通知系统接入仓库接口消息推送通道:收货完成/驳回/审核通知不再依赖 wms_notification_webhook 配置,按固定群订阅直接推送到仓库收货群与货主收货群",
|
||
"methods": [
|
||
"notify.reply"
|
||
],
|
||
"notes": [
|
||
"新增 app/service/systems/warehouseNotify.js:仓库接口出站推送服务(MD5 签名 + wms_api_app.callback_url + wms_warehouse_log 日志),供统一通知复用",
|
||
"notice/index.js 新增 FIXED_GROUP_SUBSCRIPTIONS 固定订阅:receiving_completed / receiving_rejected / receiving_reviewed → warehouse:receiving + store:receiving(群类型定义见 inbox/groups.js GROUP_TYPES)",
|
||
"notice.send 支持 channel 路由:warehouse|group=走仓库接口通道(不查 webhook 配置)、webhook=默认订阅配置、both=双通道",
|
||
"receiving.js 三处通知(sendCompletionNotice/sendReviewNotice/rejectReceiving)已传 channel=warehouse,业务链路不再依赖 wms_notification_webhook 表",
|
||
"推送复用 notify.reply,data.type=system,data 仅携带 content(通知正文)与 ext_id(业务单号,幂等),接收方只处理 content",
|
||
"货主收货群匹配需要 store_id(来自收货单 receiving.store_id);无 store_id 或未配置群时仅推仓库收货群或静默跳过,不影响业务主流程"
|
||
],
|
||
"module": "warehouse"
|
||
},
|
||
{
|
||
"version": "2026-08-16-warehouse-02",
|
||
"date": "2026-08-16",
|
||
"type": "changed",
|
||
"summary": "统一通知全面迁移仓库接口通道:移除对 wms_notification_webhook 表的读取,全部事件默认经 wms_api_app 配置按固定群订阅推送",
|
||
"methods": [
|
||
"notify.reply"
|
||
],
|
||
"notes": [
|
||
"notice.send 默认 channel 由 webhook 改为 warehouse:全部通知统一走仓库接口消息推送(wms_api_app.callback_url + 固定群订阅)",
|
||
"findMatchedWebhooks 移除 NotificationWebhook.findAll 数据库查询,webhook 通道仅支持调用方显式传入 hooks(channel=webhook 时)",
|
||
"FIXED_GROUP_SUBSCRIPTIONS 补齐全部事件:order_cancel_intercepted→warehouse:exception、order_sync_completed→store:after_sales(货主售后群,文案为每行一个订单:订单xx 姓名:xx 电话:xx 运单号:xx)、store_warehouse_print_quantity_adjusted→store:finance、storage_transfer_completed→warehouse:production、wave_strategy_quick_scan_failed→warehouse:exception",
|
||
"resolveSubjectConfig 增加 ctx.service 防御判断,兼容单元测试与最小上下文",
|
||
"test/app/service/systems/notice.test.js 适配新通道:webhook 行为用例改为显式 channel=webhook + hooks 入参,全部 12 用例通过"
|
||
],
|
||
"module": "warehouse"
|
||
},
|
||
{
|
||
"version": "2026-08-17-warehouse-01",
|
||
"date": "2026-08-17",
|
||
"type": "changed",
|
||
"summary": "订单同步通知去抖合并:订单同步完成后不再逐单立即通知,等待 3 分钟无新同步后按「仓库:货主」维度合并为一条消息统一推送到货主售后群",
|
||
"methods": [
|
||
"notify.reply"
|
||
],
|
||
"notes": [
|
||
"order_async.js 新增合并队列:每次同步成功后把订单(单号/姓名/电话/运单号)写入 Redis(order_sync_notice:list:{warehouseId}:{storeId}),到期时间记录在 order_sync_notice:queue ZSET(最后一次同步 + 3 分钟)",
|
||
"新增定时任务 app/schedule/order_sync_notice_flush.js(每 30s,worker):扫描到期成员,加锁后原子 RENAME 取出列表,合并为「订单同步完成(共 N 单)+ 每单一行」的单条消息推送",
|
||
"发送失败重试:条目放回队列,2 分钟后重试,最多 5 次后放弃并记录错误日志;单条消息最多列 30 单,超出尾部提示「……其余 N 单未列出」",
|
||
"Redis 不可用或入队失败时回退为逐单立即通知(保持原有行为),订单同步流程不受影响",
|
||
"新增 test/app/service/systems/order_async.noticeDebounce.test.js:5 个用例覆盖入队不立即发、窗口内不冲刷、到期合并单条推送、多订单合并、发送失败重试"
|
||
],
|
||
"module": "order"
|
||
},
|
||
{
|
||
"version": "2026-08-17-warehouse-02",
|
||
"date": "2026-08-17",
|
||
"type": "removed",
|
||
"summary": "移除移库完成群通知:库存移库(transferLocation 按记录移库 / transferByProduct 按商品移库)完成后不再推送「移库操作完成/按商品移库操作完成」通知",
|
||
"methods": [
|
||
"notify.reply"
|
||
],
|
||
"notes": [
|
||
"app/service/systems/storage/inventory.js 删除 transferLocation 与 transferByProduct 事务提交后的 notice.send 调用,移库业务本身不受影响",
|
||
"事件码 storage_transfer_completed 仍保留注册:app/schedule/notice_stock_remaining.js 库存余量每日提醒复用该事件码,固定群映射 warehouse:production 不变"
|
||
],
|
||
"module": "storage"
|
||
}
|
||
]
|