|
@@ -203,6 +203,44 @@ func SectionList(c *gin.Context) {
|
|
|
// }
|
|
|
// sectionList = append(sectionList, section)
|
|
|
//}
|
|
|
+ var newsList []*voice_section.VoiceSection
|
|
|
+ //var bannedSectionList []*voice_section.VoiceSection
|
|
|
+
|
|
|
+ //查找被禁用的板块ids
|
|
|
+ var bannedIds []int
|
|
|
+ for _, section := range sList {
|
|
|
+ if section.Status == 0 {
|
|
|
+ //bannedSectionList = append(bannedSectionList, section)
|
|
|
+ bannedIds = append(bannedIds, section.SectionId)
|
|
|
+ } else {
|
|
|
+ newsList = append(newsList, section)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果有被禁用的板块,去语音列表查找被禁用板块有没有语音
|
|
|
+ var lists []*voice_broadcast.VoiceBroadcast
|
|
|
+ if len(bannedIds) > 0{
|
|
|
+ lists, err = voice_section.GetVoiceSectionFromBroadcast(bannedIds)
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("查询语音播报禁用板块失败", "GetVoiceSectionFromBroadcast, Err:"+err.Error(), c)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //被禁用板块有语音,依然显示该板块
|
|
|
+ if len(lists) > 0 {
|
|
|
+ //清空切片,用新的
|
|
|
+ newsList = newsList[0:0]
|
|
|
+ bannedMap := make(map[int]int)
|
|
|
+ for _, broadcast := range lists {
|
|
|
+ bannedMap[broadcast.SectionId] = broadcast.SectionId
|
|
|
+ }
|
|
|
+ for _, section := range sList {
|
|
|
+ _,ok := bannedMap[section.SectionId]
|
|
|
+ if section.Status != 0 && ok {
|
|
|
+ newsList = append(newsList, section)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
for _, v := range vList {
|
|
|
variety := voiceResp.VarietyList{
|
|
@@ -213,7 +251,7 @@ func SectionList(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
for _, v := range varietyList {
|
|
|
- for _, s := range sList {
|
|
|
+ for _, s := range newsList {
|
|
|
if v.VarietyId == s.VarietyId {
|
|
|
section := voiceResp.SectionList{
|
|
|
ImgUrl: s.ImgUrl,
|
|
@@ -224,6 +262,9 @@ func SectionList(c *gin.Context) {
|
|
|
sectionList = append(sectionList, section)
|
|
|
}
|
|
|
}
|
|
|
+ if len(sectionList) == 0{
|
|
|
+ continue
|
|
|
+ }
|
|
|
v.Children = sectionList
|
|
|
resp = append(resp, v)
|
|
|
sectionList = []voiceResp.SectionList{}
|