正在显示
1 个修改的文件
包含
29 行增加
和
0 行删除
@@ -75,6 +75,8 @@ func (c *OpenApiController) GetChangeMedia() { | @@ -75,6 +75,8 @@ func (c *OpenApiController) GetChangeMedia() { | ||
75 | imageData []models.ChanceDataImage | 75 | imageData []models.ChanceDataImage |
76 | speedchsData []models.ChanceDataSpeechs | 76 | speedchsData []models.ChanceDataSpeechs |
77 | videosData []models.ChanceDataVideos | 77 | videosData []models.ChanceDataVideos |
78 | + chance *models.Chance | ||
79 | + chanceSource []protocol.InputElement | ||
78 | ) | 80 | ) |
79 | chanceData, err = models.GetChanceDataByChanceId(chanceId) | 81 | chanceData, err = models.GetChanceDataByChanceId(chanceId) |
80 | rsp := []map[string]interface{}{} | 82 | rsp := []map[string]interface{}{} |
@@ -82,6 +84,12 @@ func (c *OpenApiController) GetChangeMedia() { | @@ -82,6 +84,12 @@ func (c *OpenApiController) GetChangeMedia() { | ||
82 | msg = protocol.NewReturnResponse(rsp, nil) | 84 | msg = protocol.NewReturnResponse(rsp, nil) |
83 | return | 85 | return |
84 | } | 86 | } |
87 | + chance, err = models.GetChanceById(chanceId) | ||
88 | + if err != nil { | ||
89 | + msg = protocol.NewReturnResponse(rsp, nil) | ||
90 | + return | ||
91 | + } | ||
92 | + json.Unmarshal([]byte(chance.SourceContent), &chanceSource) | ||
85 | json.Unmarshal([]byte(chanceData.Images), &imageData) | 93 | json.Unmarshal([]byte(chanceData.Images), &imageData) |
86 | json.Unmarshal([]byte(chanceData.Speechs), &speedchsData) | 94 | json.Unmarshal([]byte(chanceData.Speechs), &speedchsData) |
87 | json.Unmarshal([]byte(chanceData.Videos), &videosData) | 95 | json.Unmarshal([]byte(chanceData.Videos), &videosData) |
@@ -119,6 +127,27 @@ func (c *OpenApiController) GetChangeMedia() { | @@ -119,6 +127,27 @@ func (c *OpenApiController) GetChangeMedia() { | ||
119 | rsp = append(rsp, map[string]interface{}{ | 127 | rsp = append(rsp, map[string]interface{}{ |
120 | "type": 3, "data": speedchMapData, | 128 | "type": 3, "data": speedchMapData, |
121 | }) | 129 | }) |
130 | + for i := range chanceSource { | ||
131 | + if chanceSource[i].InputType != models.InputTypeImageVedio { | ||
132 | + continue | ||
133 | + } | ||
134 | + | ||
135 | + imageVideo := []map[string]interface{}{} | ||
136 | + for ii := range chanceSource[i].Data { | ||
137 | + m := map[string]interface{}{ | ||
138 | + "type": chanceSource[i].Data[ii].Type, | ||
139 | + "path": chanceSource[i].Data[ii].Path, | ||
140 | + "cover": chanceSource[i].Data[ii].Cover, | ||
141 | + } | ||
142 | + imageVideo = append(imageVideo, m) | ||
143 | + } | ||
144 | + chanceData := map[string]interface{}{ | ||
145 | + "type": 4, | ||
146 | + "lable": chanceSource[i].Label, | ||
147 | + "data": imageVideo, | ||
148 | + } | ||
149 | + rsp = append(rsp, chanceData) | ||
150 | + } | ||
122 | msg = protocol.NewReturnResponse(rsp, nil) | 151 | msg = protocol.NewReturnResponse(rsp, nil) |
123 | return | 152 | return |
124 | 153 |
-
请 注册 或 登录 后发表评论