WMS_MAIN/methods/changes/warehouse.json

86 lines
5.9 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"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"
}
]