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

View File

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