refactor(inbox): 移除 target_url(改用ApiApp回调地址)和 ref_code(合并到ext_data)
This commit is contained in:
parent
8b978f50ec
commit
440ace1a5d
@ -57,7 +57,7 @@ class InboxService extends Service {
|
|||||||
const keyword = `%${params.keyword.trim()}%`;
|
const keyword = `%${params.keyword.trim()}%`;
|
||||||
where[Op.or] = [
|
where[Op.or] = [
|
||||||
{ ext_id: { [Op.like]: keyword } },
|
{ ext_id: { [Op.like]: keyword } },
|
||||||
{ ref_code: { [Op.like]: keyword } },
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ class InboxService extends Service {
|
|||||||
|
|
||||||
// 查找原消息
|
// 查找原消息
|
||||||
const parent = await InboxMessage.findOne({
|
const parent = await InboxMessage.findOne({
|
||||||
where: { id: parentId, warehouse_id: warehouseId },
|
where: { id: parentId, warehouse_id: warehouseId, deleted_at: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
|
|||||||
@ -189,7 +189,6 @@ class InboxReceiverService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 安全边界:校<EFBC9A>?target_url
|
// 安全边界:校<EFBC9A>?target_url
|
||||||
validateTargetUrl(data.target_url);
|
|
||||||
|
|
||||||
// 幂等检查:ext_id 已存在则直接返回
|
// 幂等检查:ext_id 已存在则直接返回
|
||||||
const exist = await InboxMessage.findOne({
|
const exist = await InboxMessage.findOne({
|
||||||
@ -209,7 +208,6 @@ class InboxReceiverService extends Service {
|
|||||||
|
|
||||||
// 推<>?body 大小限制(序列化后检查)
|
// 推<>?body 大小限制(序列化后检查)
|
||||||
const pushBody = {
|
const pushBody = {
|
||||||
ref_code: data.ref_code || null,
|
|
||||||
ext_data: data.ext_data || null,
|
ext_data: data.ext_data || null,
|
||||||
};
|
};
|
||||||
const bodySize = Buffer.byteLength(JSON.stringify(pushBody), 'utf8');
|
const bodySize = Buffer.byteLength(JSON.stringify(pushBody), 'utf8');
|
||||||
@ -228,8 +226,6 @@ class InboxReceiverService extends Service {
|
|||||||
source_extra: data.source_extra || null,
|
source_extra: data.source_extra || null,
|
||||||
target_type: targetType,
|
target_type: targetType,
|
||||||
target_channel: targetChannel,
|
target_channel: targetChannel,
|
||||||
target_url: data.target_url,
|
|
||||||
ref_code: data.ref_code || null,
|
|
||||||
ext_data: data.ext_data || null,
|
ext_data: data.ext_data || null,
|
||||||
flags: data.flags || {},
|
flags: data.flags || {},
|
||||||
push_status: 0,
|
push_status: 0,
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
use strict
|
||||||
@ -31980,13 +31980,6 @@
|
|||||||
"source": "body",
|
"source": "body",
|
||||||
"description": "目标渠道:wecom / dingtalk / feishu / warehouse_api / webhook"
|
"description": "目标渠道:wecom / dingtalk / feishu / warehouse_api / webhook"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "targetUrl",
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"source": "body",
|
|
||||||
"description": "推送目标 URL"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "targetType",
|
"name": "targetType",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -31994,13 +31987,6 @@
|
|||||||
"source": "body",
|
"source": "body",
|
||||||
"description": "目标类型:im / api / webhook,默认继承原消息的 target_type"
|
"description": "目标类型:im / api / webhook,默认继承原消息的 target_type"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "refCode",
|
|
||||||
"type": "string",
|
|
||||||
"required": false,
|
|
||||||
"source": "body",
|
|
||||||
"description": "引用编码,默认继承原消息的 ref_code"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "extData",
|
"name": "extData",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@ -244,20 +244,6 @@
|
|||||||
"source": "body",
|
"source": "body",
|
||||||
"description": "目标渠道:wecom / dingtalk / feishu / warehouse_api / webhook"
|
"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",
|
"name": "extData",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user