|
@@ -8,6 +8,7 @@ import (
|
|
|
"hongze/hongze_yb/models/request"
|
|
|
voiceResp "hongze/hongze_yb/models/response"
|
|
|
"hongze/hongze_yb/models/tables/voice_broadcast"
|
|
|
+ "hongze/hongze_yb/models/tables/voice_section"
|
|
|
"hongze/hongze_yb/services"
|
|
|
"hongze/hongze_yb/services/user"
|
|
|
"hongze/hongze_yb/utils"
|
|
@@ -66,7 +67,6 @@ func BroadcastList(c *gin.Context) {
|
|
|
// @failure 400 {string} string "发布失败"
|
|
|
// @Router /add [post]
|
|
|
func AddBroadcast(c *gin.Context) {
|
|
|
- //var req request.AddBroadcastReq
|
|
|
broadcastName := c.PostForm("broadcast_name")
|
|
|
fmt.Println("broadcastName:",broadcastName)
|
|
|
nsectionId := c.PostForm("section_id")
|
|
@@ -158,13 +158,53 @@ func AddBroadcast(c *gin.Context) {
|
|
|
|
|
|
// BroadcastList
|
|
|
// @Description 语音播报列表
|
|
|
-// @Param page_index query int false "页码"
|
|
|
-// @Param page_size query int false "每页数量"
|
|
|
-// @Param broadcast_id query int false "语音播报id"
|
|
|
-// @Param section_id query int false "板块id"
|
|
|
// @Success 200 {object} []voiceResp.BroadcastListResp
|
|
|
// @failure 400 {string} string "获取失败"
|
|
|
// @Router /section/list [get]
|
|
|
func SectionList(c *gin.Context) {
|
|
|
-
|
|
|
+ sList, err := voice_section.GetVoiceSection()
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("查询语音播报板块失败", "GetVoiceSection, Err:"+err.Error(), c)
|
|
|
+ }
|
|
|
+ vList, err := voice_section.GetVoiceVariety()
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("查询语音播报板块失败", "GetVoiceSection, Err:"+err.Error(), c)
|
|
|
+ }
|
|
|
+ var sectionList []voiceResp.SectionList
|
|
|
+ var varietyList []voiceResp.VarietyList
|
|
|
+ var resp []voiceResp.VarietyList
|
|
|
+ //var resp voiceResp.SectionListResp
|
|
|
+ //for _, s := range sList {
|
|
|
+ // section := voiceResp.SectionList{
|
|
|
+ // SectionId: s.SectionId,
|
|
|
+ // SectionName: s.SectionName,
|
|
|
+ // Status: s.Status,
|
|
|
+ // }
|
|
|
+ // sectionList = append(sectionList, section)
|
|
|
+ //}
|
|
|
+
|
|
|
+ for _, v := range vList {
|
|
|
+ variety := voiceResp.VarietyList{
|
|
|
+ VarietyId: v.VarietyId,
|
|
|
+ VarietyName: v.VarietyName,
|
|
|
+ }
|
|
|
+ varietyList = append(varietyList, variety)
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range varietyList {
|
|
|
+ for _, s := range sList {
|
|
|
+ if v.VarietyId == s.VarietyId {
|
|
|
+ section := voiceResp.SectionList{
|
|
|
+ SectionId: s.SectionId,
|
|
|
+ SectionName: s.SectionName,
|
|
|
+ Status: s.Status,
|
|
|
+ }
|
|
|
+ sectionList = append(sectionList, section)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ v.Children = sectionList
|
|
|
+ resp = append(resp, v)
|
|
|
+ sectionList = []voiceResp.SectionList{}
|
|
|
+ }
|
|
|
+ response.OkData("上传成功", resp, c)
|
|
|
}
|