This commit is contained in:
丹尼尔
2026-03-11 18:40:11 +08:00
parent a424efb784
commit 30a57d993c
5 changed files with 476 additions and 2 deletions

View File

@@ -628,7 +628,24 @@
const name = prompt('群组名称');
if (!name) return;
try {
await callApi('/api/push-groups', { method: 'POST', body: JSON.stringify({ key, name, customer_ids: [], tag_ids: [] }) });
// 将当前「选择接收人」中勾选的联系人映射为客户ID作为群组初始成员
let customerIds = [];
try {
const customersRes = await callApi('/api/customers?key=' + encodeURIComponent(key));
const allCustomers = customersRes.items || [];
if (Array.isArray(massSelectedWxids) && massSelectedWxids.length) {
customerIds = allCustomers
.filter(c => c.wxid && massSelectedWxids.includes(c.wxid))
.map(c => c.id)
.filter(Boolean);
}
} catch (e) {
// 客户加载失败时,不阻断建群逻辑,只是群组初始客户数为 0
}
await callApi('/api/push-groups', {
method: 'POST',
body: JSON.stringify({ key, name, customer_ids: customerIds, tag_ids: [] })
});
loadPushGroups();
} catch (e) { alert(e.message); }
}