Explorar o código

refactor(udpforwarding):重构获取 UDP 防护 ID 列表函数

- 修改函数名 GetUdpForwardingWafUdpAllIds 的参数名从 udpId 到 hostId
- 更新查询条件,从查询 id列改为查询 host_id 列- 修正查询的字段,从 waf_udp_id 改为 id
fusu hai 1 mes
pai
achega
7ca8c08041
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      internal/repository/udpforwarding.go

+ 2 - 2
internal/repository/udpforwarding.go

@@ -84,9 +84,9 @@ func (r *udpForWardingRepository) GetUdpForwardingPortCountByHostId(ctx context.
 	return count, nil
 }
 
-func (r *udpForWardingRepository) GetUdpForwardingWafUdpAllIds(ctx context.Context, udpId int) ([]int, error) {
+func (r *udpForWardingRepository) GetUdpForwardingWafUdpAllIds(ctx context.Context, hostId int) ([]int, error) {
 	var res []int
-	if err:= r.db.WithContext(ctx).Model(&model.UdpForWarding{}).Where("id = ?", udpId).Select("waf_udp_id").Find(&res).Error; err != nil {
+	if err:= r.db.WithContext(ctx).Model(&model.UdpForWarding{}).Where("host_id = ?", hostId).Select("id").Find(&res).Error; err != nil {
 		return nil, err
 	}
 	return res, nil