|
@@ -64,7 +64,7 @@ func (slf AudioCtl) Upload(c *gin.Context) {
|
|
|
util.ResponseFormat(c, code.RequestParamError, "上传失败")
|
|
util.ResponseFormat(c, code.RequestParamError, "上传失败")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if filepath.Ext(filename) == ".mp3" || filepath.Ext(filename) == ".wav" {
|
|
|
|
|
|
|
+ if strings.ToLower(filepath.Ext(filename)) == ".mp3" || strings.ToLower(filepath.Ext(filename)) == ".wav" {
|
|
|
timeStr := arr[4] + strings.Split(arr[5], ".")[0]
|
|
timeStr := arr[4] + strings.Split(arr[5], ".")[0]
|
|
|
t, err := time.ParseInLocation("20060102150405", timeStr, time.Local)
|
|
t, err := time.ParseInLocation("20060102150405", timeStr, time.Local)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -82,7 +82,7 @@ func (slf AudioCtl) Upload(c *gin.Context) {
|
|
|
audio.OccurrenceAt = t
|
|
audio.OccurrenceAt = t
|
|
|
audio.IsFollowed = 0
|
|
audio.IsFollowed = 0
|
|
|
}
|
|
}
|
|
|
- if filepath.Ext(filename) == ".txt" {
|
|
|
|
|
|
|
+ if strings.ToLower(filepath.Ext(filename)) == ".txt" {
|
|
|
audio.TxtFilePath = filePath
|
|
audio.TxtFilePath = filePath
|
|
|
//读取filepath文件内容到bts
|
|
//读取filepath文件内容到bts
|
|
|
bts, err := os.ReadFile(filePath)
|
|
bts, err := os.ReadFile(filePath)
|