refactor(ckchat): 优化联系人列表创建逻辑并移除调试日志
- 将重复的kfSelected过滤逻辑提取到公共位置 - 为groupType=2的情况添加未分组联系人查询支持 - 移除不必要的console.log调试输出
This commit is contained in:
@@ -21,7 +21,6 @@ export const createContractList = async (
|
|||||||
for (const label of countLables) {
|
for (const label of countLables) {
|
||||||
let data;
|
let data;
|
||||||
if (label.groupType === 1) {
|
if (label.groupType === 1) {
|
||||||
console.log(label.groupName);
|
|
||||||
if (label.id == 0) {
|
if (label.id == 0) {
|
||||||
data = await contractService.findWhereMultiple([
|
data = await contractService.findWhereMultiple([
|
||||||
{
|
{
|
||||||
@@ -30,22 +29,28 @@ export const createContractList = async (
|
|||||||
value: realGroup,
|
value: realGroup,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
// 过滤出 kfSelected 对应的联系人
|
|
||||||
if (kfSelected && kfSelected != 0) {
|
|
||||||
data = data.filter(contact => contact.wechatAccountId === kfSelected);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
data = await contractService.findWhere("groupId", label.id);
|
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);
|
// console.log(`标签 ${label.groupName} 对应的联系人数据:`, data);
|
||||||
} else if (label.groupType === 2) {
|
} else if (label.groupType === 2) {
|
||||||
// groupType: 2, 查询 weChatGroupService
|
// 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) {
|
if (kfSelected && kfSelected != 0) {
|
||||||
data = data.filter(contact => contact.wechatAccountId === kfSelected);
|
data = data.filter(contact => contact.wechatAccountId === kfSelected);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user