Browse Source

Merge branch 'feature/label'

* feature/label:
  修复bug
boweniac 3 months ago
parent
commit
2f7abd61b6
1 changed files with 8 additions and 5 deletions
  1. 8 5
      internal/logic/Wxhook/get_friends_and_groups_logic.go

+ 8 - 5
internal/logic/Wxhook/get_friends_and_groups_logic.go

@@ -153,11 +153,14 @@ func (l *GetFriendsAndGroupsLogic) GetFriendsAndGroups(req *types.IDReq) (resp *
 				if len(newFriendIds) > 0 && len(newLagIds) > 0 {
 					for id, lags := range newFriendIds {
 						for _, lag := range lags {
-							l.svcCtx.DB.LabelRelationship.Create().
-								SetLabelID(wxSysSet[lag]).
-								SetContactID(id).
-								SetOrganizationID(organizationId).
-								Save(l.ctx)
+							label_id := wxSysSet[lag]
+							if label_id != 0 {
+								l.svcCtx.DB.LabelRelationship.Create().
+									SetLabelID(label_id).
+									SetContactID(id).
+									SetOrganizationID(organizationId).
+									Save(l.ctx)
+							}
 						}
 					}
 				}