From 9f78e3b126b15a9b331c3a1a318da1ceea30114c Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期一, 29 七月 2024 16:15:52 +0800
Subject: [PATCH] export

---
 service/process.go   |    4 ++--
 controllers/audio.go |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/controllers/audio.go b/controllers/audio.go
index ef23f56..36ef8d9 100644
--- a/controllers/audio.go
+++ b/controllers/audio.go
@@ -64,7 +64,7 @@
 			util.ResponseFormat(c, code.RequestParamError, "涓婁紶澶辫触")
 			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]
 			t, err := time.ParseInLocation("20060102150405", timeStr, time.Local)
 			if err != nil {
@@ -82,7 +82,7 @@
 			audio.OccurrenceAt = t
 			audio.IsFollowed = 0
 		}
-		if filepath.Ext(filename) == ".txt" {
+		if strings.ToLower(filepath.Ext(filename)) == ".txt" {
 			audio.TxtFilePath = filePath
 			//璇诲彇filepath鏂囦欢鍐呭鍒癰ts
 			bts, err := os.ReadFile(filePath)
diff --git a/service/process.go b/service/process.go
index 8e9bdb3..9b20951 100644
--- a/service/process.go
+++ b/service/process.go
@@ -319,10 +319,10 @@
 					audio := &models.Audio{}
 					isOk := true
 					// 鍒ゆ柇鏂囦欢绫诲瀷鏄惁涓�.mp3鎴�.wav
-					if filepath.Ext(event.Name) == ".mp3" || filepath.Ext(event.Name) == ".wav" {
+					if strings.ToLower(filepath.Ext(event.Name)) == ".mp3" || strings.ToLower(filepath.Ext(event.Name)) == ".wav" {
 						isOk = audoF(event.Name, fileName, audio) && txtF(pair[name], audio)
 					}
-					if filepath.Ext(event.Name) == ".txt" {
+					if strings.ToLower(filepath.Ext(event.Name)) == ".txt" {
 						isOk = audoF(pair[name], filepath.Base(pair[name]), audio) && txtF(event.Name, audio)
 					}
 					if !isOk {

--
Gitblit v1.8.0