From f58b95cd95e9c02c11d2dd5459aeba409edc8025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Thu, 18 Sep 2025 15:06:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ckchat):=20=E4=BC=98=E5=8C=96=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BA=E5=88=97=E8=A1=A8=E5=88=9B=E5=BB=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=B9=B6=E7=A7=BB=E9=99=A4=E8=B0=83=E8=AF=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将重复的kfSelected过滤逻辑提取到公共位置 - 为groupType=2的情况添加未分组联系人查询支持 - 移除不必要的console.log调试输出 --- Touchkebao/src/store/module/ckchat/api.ts | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Touchkebao/src/store/module/ckchat/api.ts b/Touchkebao/src/store/module/ckchat/api.ts index c10f10d5..f7f365a9 100644 --- a/Touchkebao/src/store/module/ckchat/api.ts +++ b/Touchkebao/src/store/module/ckchat/api.ts @@ -21,7 +21,6 @@ export const createContractList = async ( for (const label of countLables) { let data; if (label.groupType === 1) { - console.log(label.groupName); if (label.id == 0) { data = await contractService.findWhereMultiple([ { @@ -30,22 +29,28 @@ export const createContractList = async ( value: realGroup, }, ]); - // 过滤出 kfSelected 对应的联系人 - if (kfSelected && kfSelected != 0) { - data = data.filter(contact => contact.wechatAccountId === kfSelected); - } } else { data = await contractService.findWhere("groupId", label.id); - // 过滤出 kfSelected 对应的联系人 - if (kfSelected && kfSelected != 0) { - data = data.filter(contact => contact.wechatAccountId === kfSelected); - } } - + // 过滤出 kfSelected 对应的联系人 + if (kfSelected && kfSelected != 0) { + data = data.filter(contact => contact.wechatAccountId === kfSelected); + } // console.log(`标签 ${label.groupName} 对应的联系人数据:`, data); } else if (label.groupType === 2) { // groupType: 2, 查询 weChatGroupService - data = await weChatGroupService.findWhere("groupId", label.id); + if (label.id == 0) { + data = await weChatGroupService.findWhereMultiple([ + { + field: "groupId", + operator: "notIn", + value: realGroup, + }, + ]); + } else { + data = await weChatGroupService.findWhere("groupId", label.id); + // 过滤出 kfSelected 对应的联系人 + } if (kfSelected && kfSelected != 0) { data = data.filter(contact => contact.wechatAccountId === kfSelected); }