fix anwser token and database issus

This commit is contained in:
tamakyi
2026-09-15 11:06:09 +08:00
parent e683e798aa
commit adcc42cc8c
33 changed files with 1011 additions and 802 deletions
+4 -6
View File
@@ -109,24 +109,22 @@ func uploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader, as
return "", errors.Wrap(err, "reset reader")
}
// 4. 根据格式进行转换或直接使用原图
// 4. 按格式转换或直接使用原图
switch format {
case "gif":
webpData, err := convertGifToAnimatedWebP(fileData)
if err != nil {
// 转换失败则回退到原始 GIF
uploadData = fileData
uploadData = fileData // 转换失败回退原始 GIF
contentType = "image/gif"
} else {
uploadData = webpData
contentType = "image/webp"
}
default:
// 静态图片(JPEG / PNG / WebP 等)转换为静态 WebP
// 静态图片(JPEG / PNG / WebP 等)转静态 WebP
webpData, err := ConvertStaticImageToWebP(fileReader)
if err != nil {
// 转换失败时回退到原始图片
uploadData = fileData
uploadData = fileData // 转换失败回退原图
contentType = mimeTypeFromFormat(format)
} else {
uploadData = webpData