From 3b4999f3d163259205fd6d7039ad7facdc036159 Mon Sep 17 00:00:00 2001 From: ydajiang Date: Fri, 31 Oct 2025 17:58:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E9=80=9A=E9=81=93?= =?UTF-8?q?=E6=B2=A1=E4=BF=9D=E5=AD=98=E8=BF=87=E6=BB=A4=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stack/device.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/stack/device.go b/stack/device.go index ad22ffa..7f2df94 100644 --- a/stack/device.go +++ b/stack/device.go @@ -308,6 +308,33 @@ func (d *Device) SaveChannels(list []*CatalogResponse) ([]*dao.ChannelModel, err } } + // 过滤通道 + device, _ := dao.Device.QueryDevice(d.DeviceID) + var dropChannelType string + if device.DropChannelType != "" { + dropChannelType = strings.TrimSpace(device.DropChannelType) + } else { + dropChannelType = strings.TrimSpace(common.Config.GlobalDropChannelType) + } + + if dropChannelType != "" { + var dropChannelTypes []int + for _, code := range strings.Split(dropChannelType, ",") { + if code != "" { + typeCode, _ := strconv.Atoi(code) + dropChannelTypes = append(dropChannelTypes, typeCode) + } + } + + for _, channel := range channels { + for _, dropType := range dropChannelTypes { + if dropType == channel.TypeCode { + channel.DropMark = 1 + } + } + } + } + err := dao.Channel.SaveChannels(channels) if err != nil { log.Sugar.Errorf("save channels failed, device: %s, err: %s", d.DeviceID, err.Error())