|
@@ -89,16 +89,25 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
|
|
resp.Data.Total = data.PageDetails.Total
|
|
resp.Data.Total = data.PageDetails.Total
|
|
|
|
|
|
wxWxids := []string{}
|
|
wxWxids := []string{}
|
|
- wxWxidsSet := make(map[string]string)
|
|
|
|
|
|
+ wxWxidsSet := make(map[string]*ent.Wx)
|
|
|
|
+ blockListSet := make(map[string]struct{})
|
|
|
|
+ groupBlockListSet := make(map[string]struct{})
|
|
for _, v := range data.List {
|
|
for _, v := range data.List {
|
|
wxWxids = append(wxWxids, v.WxWxid)
|
|
wxWxids = append(wxWxids, v.WxWxid)
|
|
}
|
|
}
|
|
wxs, err := l.svcCtx.DB.Wx.Query().Where(wx.WxidIn(wxWxids...)).All(l.ctx)
|
|
wxs, err := l.svcCtx.DB.Wx.Query().Where(wx.WxidIn(wxWxids...)).All(l.ctx)
|
|
for _, w := range wxs {
|
|
for _, w := range wxs {
|
|
- wxWxidsSet[w.Wxid] = w.Nickname
|
|
|
|
|
|
+ wxWxidsSet[w.Wxid] = w
|
|
|
|
+ for _, b := range w.BlockList {
|
|
|
|
+ blockListSet[w.Wxid+"_"+b] = struct{}{}
|
|
|
|
+ }
|
|
|
|
+ for _, g := range w.GroupBlockList {
|
|
|
|
+ groupBlockListSet[w.Wxid+"_"+g] = struct{}{}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
for _, v := range data.List {
|
|
for _, v := range data.List {
|
|
|
|
+ isInBlockList := false
|
|
labelRelationships := make([]types.ContactLabelList, 0)
|
|
labelRelationships := make([]types.ContactLabelList, 0)
|
|
if v.Edges.ContactRelationships != nil {
|
|
if v.Edges.ContactRelationships != nil {
|
|
for _, lr := range v.Edges.ContactRelationships {
|
|
for _, lr := range v.Edges.ContactRelationships {
|
|
@@ -112,10 +121,23 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var wxNickname string
|
|
var wxNickname string
|
|
- if wxWxidsSet[v.WxWxid] == "" {
|
|
|
|
|
|
+ if wxWxidsSet[v.WxWxid] == nil {
|
|
wxNickname = v.WxWxid
|
|
wxNickname = v.WxWxid
|
|
} else {
|
|
} else {
|
|
- wxNickname = wxWxidsSet[v.WxWxid]
|
|
|
|
|
|
+ wxNickname = wxWxidsSet[v.WxWxid].Nickname
|
|
|
|
+ }
|
|
|
|
+ if v.Type == 1 {
|
|
|
|
+ if _, exists := blockListSet[v.WxWxid+"_"+"ALL"]; exists {
|
|
|
|
+ isInBlockList = true
|
|
|
|
+ } else {
|
|
|
|
+ _, isInBlockList = blockListSet[v.WxWxid+"_"+v.Wxid]
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if _, exists := groupBlockListSet[v.WxWxid+"_"+"ALL"]; exists {
|
|
|
|
+ isInBlockList = true
|
|
|
|
+ } else {
|
|
|
|
+ _, isInBlockList = groupBlockListSet[v.WxWxid+"_"+v.Wxid]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
resp.Data.Data = append(resp.Data.Data,
|
|
resp.Data.Data = append(resp.Data.Data,
|
|
@@ -143,6 +165,7 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
|
|
Gname: &v.Gname,
|
|
Gname: &v.Gname,
|
|
V3: &v.V3,
|
|
V3: &v.V3,
|
|
LabelRelationships: labelRelationships,
|
|
LabelRelationships: labelRelationships,
|
|
|
|
+ IsInBlockList: &isInBlockList,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|