|
@@ -24,7 +24,6 @@ import (
|
|
"hongze/hongze_yb/services/user"
|
|
"hongze/hongze_yb/services/user"
|
|
"hongze/hongze_yb/services/wx_app"
|
|
"hongze/hongze_yb/services/wx_app"
|
|
"hongze/hongze_yb/utils"
|
|
"hongze/hongze_yb/utils"
|
|
- "io/ioutil"
|
|
|
|
"net/url"
|
|
"net/url"
|
|
"os"
|
|
"os"
|
|
"path"
|
|
"path"
|
|
@@ -241,17 +240,17 @@ func UploadAudio(c *gin.Context) {
|
|
response.FailMsg("文件生成失败", "UploadAudio 文件生成失败, Err:"+err.Error(), c)
|
|
response.FailMsg("文件生成失败", "UploadAudio 文件生成失败, Err:"+err.Error(), c)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // 获取音频文件时长
|
|
|
|
- fByte, err := ioutil.ReadFile(fpath)
|
|
|
|
- if err != nil {
|
|
|
|
- response.FailMsg("读取本地文件失败", "UploadAudio 读取本地文件失败", c)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if len(fByte) <= 0 {
|
|
|
|
- response.FailMsg("文件大小有误", "UploadAudio 文件大小有误", c)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- seconds, err := services.GetMP3PlayDuration(fByte)
|
|
|
|
|
|
+ //// 获取音频文件时长
|
|
|
|
+ //fByte, err := ioutil.ReadFile(fpath)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // response.FailMsg("读取本地文件失败", "UploadAudio 读取本地文件失败", c)
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ //if len(fByte) <= 0 {
|
|
|
|
+ // response.FailMsg("文件大小有误", "UploadAudio 文件大小有误", c)
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ seconds, err := utils.GetVideoPlaySeconds(fpath) //services.GetMP3PlayDuration(fByte)
|
|
if err != nil {
|
|
if err != nil {
|
|
response.FailMsg("读取文件时长失败", "UploadAudio 读取文件时长失败", c)
|
|
response.FailMsg("读取文件时长失败", "UploadAudio 读取文件时长失败", c)
|
|
return
|
|
return
|