...
|
...
|
@@ -75,6 +75,8 @@ func (c *OpenApiController) GetChangeMedia() { |
|
|
imageData []models.ChanceDataImage
|
|
|
speedchsData []models.ChanceDataSpeechs
|
|
|
videosData []models.ChanceDataVideos
|
|
|
chance *models.Chance
|
|
|
chanceSource []protocol.InputElement
|
|
|
)
|
|
|
chanceData, err = models.GetChanceDataByChanceId(chanceId)
|
|
|
rsp := []map[string]interface{}{}
|
...
|
...
|
@@ -82,6 +84,12 @@ func (c *OpenApiController) GetChangeMedia() { |
|
|
msg = protocol.NewReturnResponse(rsp, nil)
|
|
|
return
|
|
|
}
|
|
|
chance, err = models.GetChanceById(chanceId)
|
|
|
if err != nil {
|
|
|
msg = protocol.NewReturnResponse(rsp, nil)
|
|
|
return
|
|
|
}
|
|
|
json.Unmarshal([]byte(chance.SourceContent), &chanceSource)
|
|
|
json.Unmarshal([]byte(chanceData.Images), &imageData)
|
|
|
json.Unmarshal([]byte(chanceData.Speechs), &speedchsData)
|
|
|
json.Unmarshal([]byte(chanceData.Videos), &videosData)
|
...
|
...
|
@@ -119,6 +127,27 @@ func (c *OpenApiController) GetChangeMedia() { |
|
|
rsp = append(rsp, map[string]interface{}{
|
|
|
"type": 3, "data": speedchMapData,
|
|
|
})
|
|
|
for i := range chanceSource {
|
|
|
if chanceSource[i].InputType != models.InputTypeImageVedio {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
imageVideo := []map[string]interface{}{}
|
|
|
for ii := range chanceSource[i].Data {
|
|
|
m := map[string]interface{}{
|
|
|
"type": chanceSource[i].Data[ii].Type,
|
|
|
"path": chanceSource[i].Data[ii].Path,
|
|
|
"cover": chanceSource[i].Data[ii].Cover,
|
|
|
}
|
|
|
imageVideo = append(imageVideo, m)
|
|
|
}
|
|
|
chanceData := map[string]interface{}{
|
|
|
"type": 4,
|
|
|
"lable": chanceSource[i].Label,
|
|
|
"data": imageVideo,
|
|
|
}
|
|
|
rsp = append(rsp, chanceData)
|
|
|
}
|
|
|
msg = protocol.NewReturnResponse(rsp, nil)
|
|
|
return
|
|
|
|
...
|
...
|
|