1、优化"查询系统渠道编码"接口,新增产品ID;

This commit is contained in:
chenlin 2025-05-27 18:00:19 +08:00
parent 24e7e90a7e
commit ca88bb7ab6
2 changed files with 6 additions and 15 deletions

View File

@ -1859,21 +1859,11 @@ func (e MiGuDeployService) SysChannelList(c *gin.Context) {
return return
} }
// 4. 构建所有组合,并剔除重复的渠道编码 for _, item := range mgChannels {
channelSet := make(map[string]struct{}) channels = append(channels, models.ChannelData{
ChannelCode: item.SubChannelCode,
// 添加渠道表中的主渠道和子渠道编码 ProductID: item.ProductID,
for _, channel := range mgChannels { })
channelSet[channel.SubChannelCode] = struct{}{}
}
// 5. 转换为ChannelData结构体并分页
for code := range channelSet {
if code != "" { // 跳过空的channel_code
channels = append(channels, models.ChannelData{
ChannelCode: code,
})
}
} }
// 总数 // 总数

View File

@ -528,6 +528,7 @@ type SysChannelListResp struct {
type ChannelData struct { type ChannelData struct {
ChannelCode string `json:"channel_code"` // 渠道编码 ChannelCode string `json:"channel_code"` // 渠道编码
ProductID int `json:"product_id"` // 产品ID
} }
// AddProductReq 添加新产品请求结构体 // AddProductReq 添加新产品请求结构体