|
@@ -241,6 +241,37 @@ func (slf AudioCtl) AudioInfo(c *gin.Context) {
|
|
|
util.ResponseFormat(c, code.UpdateSuccess, audio)
|
|
util.ResponseFormat(c, code.UpdateSuccess, audio)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// AudioDownload
|
|
|
|
|
+// @Tags 音频
|
|
|
|
|
+// @Summary 音频下载
|
|
|
|
|
+// @Produce application/json
|
|
|
|
|
+// @Param object query request.ProcessAudio true "参数"
|
|
|
|
|
+// @Success 200 {object} util.Response{data=models.Audio} "成功"
|
|
|
|
|
+// @Router /api-sa/v1/audio/download [get]
|
|
|
|
|
+func (slf AudioCtl) AudioDownload(c *gin.Context) {
|
|
|
|
|
+ var params request.ProcessAudio
|
|
|
|
|
+ if err := c.ShouldBindQuery(¶ms); err != nil {
|
|
|
|
|
+ util.ResponseFormat(c, code.RequestParamError, err.Error())
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ audio, err := models.NewAudioSearch().SetID(params.ID).First()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ util.ResponseFormat(c, code.InternalError, "查询失败")
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if audio.FilePath == "" {
|
|
|
|
|
+ util.ResponseFormat(c, code.InternalError, "查询失败")
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ c.Header("Content-Description", "File Transfer")
|
|
|
|
|
+ c.Header("Content-Disposition", "attachment; filename="+audio.Name)
|
|
|
|
|
+ c.Header("Content-Type", "application/octet-stream")
|
|
|
|
|
+ c.File(audio.FilePath)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// BatchProcess
|
|
// BatchProcess
|
|
|
// @Tags 音频
|
|
// @Tags 音频
|
|
|
// @Summary 批量处理音频
|
|
// @Summary 批量处理音频
|