From 440ace1a5d44065048dfb50430d60f69737280ce Mon Sep 17 00:00:00 2001 From: liufumingren Date: Mon, 3 Aug 2026 03:17:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(inbox):=20=E7=A7=BB=E9=99=A4=20target?= =?UTF-8?q?=5Furl=EF=BC=88=E6=94=B9=E7=94=A8ApiApp=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=EF=BC=89=E5=92=8C=20ref=5Fcode=EF=BC=88?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=88=B0ext=5Fdata=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/inbox/index.js | 4 ++-- app/service/inbox/receiver.js | 4 ---- .../20260803140000-inbox-remove-url-refcode.js | 1 + methods/system.json | 14 -------------- methods/warehouse.json | 14 -------------- 5 files changed, 3 insertions(+), 34 deletions(-) create mode 100644 database/migrations/20260803140000-inbox-remove-url-refcode.js diff --git a/app/service/inbox/index.js b/app/service/inbox/index.js index 3d2d9e2..c20b065 100644 --- a/app/service/inbox/index.js +++ b/app/service/inbox/index.js @@ -57,7 +57,7 @@ class InboxService extends Service { const keyword = `%${params.keyword.trim()}%`; where[Op.or] = [ { ext_id: { [Op.like]: keyword } }, - { ref_code: { [Op.like]: keyword } }, + ]; } @@ -215,7 +215,7 @@ class InboxService extends Service { // 查找原消息 const parent = await InboxMessage.findOne({ - where: { id: parentId, warehouse_id: warehouseId }, + where: { id: parentId, warehouse_id: warehouseId, deleted_at: null }, }); if (!parent) { diff --git a/app/service/inbox/receiver.js b/app/service/inbox/receiver.js index 81bab94..828be7f 100644 --- a/app/service/inbox/receiver.js +++ b/app/service/inbox/receiver.js @@ -189,7 +189,6 @@ class InboxReceiverService extends Service { } // 安全边界:校�?target_url - validateTargetUrl(data.target_url); // 幂等检查:ext_id 已存在则直接返回 const exist = await InboxMessage.findOne({ @@ -209,7 +208,6 @@ class InboxReceiverService extends Service { // 推�?body 大小限制(序列化后检查) const pushBody = { - ref_code: data.ref_code || null, ext_data: data.ext_data || null, }; const bodySize = Buffer.byteLength(JSON.stringify(pushBody), 'utf8'); @@ -228,8 +226,6 @@ class InboxReceiverService extends Service { source_extra: data.source_extra || null, target_type: targetType, target_channel: targetChannel, - target_url: data.target_url, - ref_code: data.ref_code || null, ext_data: data.ext_data || null, flags: data.flags || {}, push_status: 0, diff --git a/database/migrations/20260803140000-inbox-remove-url-refcode.js b/database/migrations/20260803140000-inbox-remove-url-refcode.js new file mode 100644 index 0000000..1d16864 --- /dev/null +++ b/database/migrations/20260803140000-inbox-remove-url-refcode.js @@ -0,0 +1 @@ +use strict \ No newline at end of file diff --git a/methods/system.json b/methods/system.json index 59b9c11..984938b 100644 --- a/methods/system.json +++ b/methods/system.json @@ -31980,13 +31980,6 @@ "source": "body", "description": "目标渠道:wecom / dingtalk / feishu / warehouse_api / webhook" }, - { - "name": "targetUrl", - "type": "string", - "required": true, - "source": "body", - "description": "推送目标 URL" - }, { "name": "targetType", "type": "string", @@ -31994,13 +31987,6 @@ "source": "body", "description": "目标类型:im / api / webhook,默认继承原消息的 target_type" }, - { - "name": "refCode", - "type": "string", - "required": false, - "source": "body", - "description": "引用编码,默认继承原消息的 ref_code" - }, { "name": "extData", "type": "object", diff --git a/methods/warehouse.json b/methods/warehouse.json index 7cd2644..8389202 100644 --- a/methods/warehouse.json +++ b/methods/warehouse.json @@ -244,20 +244,6 @@ "source": "body", "description": "目标渠道:wecom / dingtalk / feishu / warehouse_api / webhook" }, - { - "name": "targetUrl", - "type": "string", - "required": true, - "source": "body", - "description": "推送目标 URL(IM Bot webhook 地址 / API 回调地址),仅允许 https://,禁止内网 IP" - }, - { - "name": "refCode", - "type": "string", - "required": false, - "source": "body", - "description": "外部引用编码,推送/回执时原样携带" - }, { "name": "extData", "type": "object",