Browse Source

fix: Get Uuids

lejianwen 10 months ago
parent
commit
746e2a6052
1 changed files with 8 additions and 1 deletions
  1. 8 1
      service/peer.go

+ 8 - 1
service/peer.go

@@ -126,7 +126,14 @@ func (ps *PeerService) GetUuidListByIDs(ids []uint) ([]string, error) {
126
 	err := DB.Model(&model.Peer{}).
126
 	err := DB.Model(&model.Peer{}).
127
 		Where("row_id in (?)", ids).
127
 		Where("row_id in (?)", ids).
128
 		Pluck("uuid", &uuids).Error
128
 		Pluck("uuid", &uuids).Error
129
-	return uuids, err
129
+	//过滤uuids中的空字符串
130
+	var newUuids []string
131
+	for _, uuid := range uuids {
132
+		if uuid != "" {
133
+			newUuids = append(newUuids, uuid)
134
+		}
135
+	}
136
+	return newUuids, err
130
 }
137
 }
131
 
138
 
132
 // BatchDelete 批量删除, 同时也应该删除token
139
 // BatchDelete 批量删除, 同时也应该删除token