fix:bug
This commit is contained in:
@@ -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); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user