作者 tangxvhui

修改

@@ -79,7 +79,8 @@ func (c *OpenApiController) GetChangeMedia() { @@ -79,7 +79,8 @@ func (c *OpenApiController) GetChangeMedia() {
79 chanceSource []protocol.InputElement 79 chanceSource []protocol.InputElement
80 ) 80 )
81 chanceData, err = models.GetChanceDataByChanceId(chanceId) 81 chanceData, err = models.GetChanceDataByChanceId(chanceId)
82 - rsp := []map[string]interface{}{} 82 + rsp := map[string]interface{}{}
  83 + rspOrther := []map[string]interface{}{}
83 if err != nil { 84 if err != nil {
84 msg = protocol.NewReturnResponse(rsp, nil) 85 msg = protocol.NewReturnResponse(rsp, nil)
85 return 86 return
@@ -103,7 +104,7 @@ func (c *OpenApiController) GetChangeMedia() { @@ -103,7 +104,7 @@ func (c *OpenApiController) GetChangeMedia() {
103 } 104 }
104 videoMapData = append(videoMapData, m) 105 videoMapData = append(videoMapData, m)
105 } 106 }
106 - rsp = append(rsp, map[string]interface{}{ 107 + rspOrther = append(rspOrther, map[string]interface{}{
107 "type": 1, "data": videoMapData, 108 "type": 1, "data": videoMapData,
108 }) 109 })
109 110
@@ -114,7 +115,7 @@ func (c *OpenApiController) GetChangeMedia() { @@ -114,7 +115,7 @@ func (c *OpenApiController) GetChangeMedia() {
114 } 115 }
115 imgMapData = append(imgMapData, m) 116 imgMapData = append(imgMapData, m)
116 } 117 }
117 - rsp = append(rsp, map[string]interface{}{ 118 + rspOrther = append(rspOrther, map[string]interface{}{
118 "type": 2, "data": imgMapData, 119 "type": 2, "data": imgMapData,
119 }) 120 })
120 speedchMapData := []map[string]interface{}{} 121 speedchMapData := []map[string]interface{}{}
@@ -124,14 +125,14 @@ func (c *OpenApiController) GetChangeMedia() { @@ -124,14 +125,14 @@ func (c *OpenApiController) GetChangeMedia() {
124 } 125 }
125 speedchMapData = append(speedchMapData, m) 126 speedchMapData = append(speedchMapData, m)
126 } 127 }
127 - rsp = append(rsp, map[string]interface{}{ 128 + rspOrther = append(rspOrther, map[string]interface{}{
128 "type": 3, "data": speedchMapData, 129 "type": 3, "data": speedchMapData,
129 }) 130 })
  131 + rspChanceData := []map[string]interface{}{}
130 for i := range chanceSource { 132 for i := range chanceSource {
131 if chanceSource[i].InputType != models.InputTypeImageVedio { 133 if chanceSource[i].InputType != models.InputTypeImageVedio {
132 continue 134 continue
133 } 135 }
134 -  
135 imageVideo := []map[string]interface{}{} 136 imageVideo := []map[string]interface{}{}
136 for ii := range chanceSource[i].Data { 137 for ii := range chanceSource[i].Data {
137 m := map[string]interface{}{ 138 m := map[string]interface{}{
@@ -142,12 +143,13 @@ func (c *OpenApiController) GetChangeMedia() { @@ -142,12 +143,13 @@ func (c *OpenApiController) GetChangeMedia() {
142 imageVideo = append(imageVideo, m) 143 imageVideo = append(imageVideo, m)
143 } 144 }
144 chanceData := map[string]interface{}{ 145 chanceData := map[string]interface{}{
145 - "type": 4,  
146 "lable": chanceSource[i].Label, 146 "lable": chanceSource[i].Label,
147 "data": imageVideo, 147 "data": imageVideo,
148 } 148 }
149 - rsp = append(rsp, chanceData) 149 + rspChanceData = append(rspChanceData, chanceData)
150 } 150 }
  151 + rsp["orther"] = rspOrther
  152 + rsp["chance_data"] = rspChanceData
151 msg = protocol.NewReturnResponse(rsp, nil) 153 msg = protocol.NewReturnResponse(rsp, nil)
152 return 154 return
153 155