修复ppt制作保存ppt问题
This commit is contained in:
parent
dd89e6b92e
commit
61ff3b0547
|
|
@ -8,10 +8,12 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -374,16 +376,21 @@ func SparkSavePPTFileToUser(fileUrl string) (string, string, error) {
|
|||
//https://bjcdn.openstorage.cn/xinghuo-privatedata/zhiwen/2025-04-02/6ebfc0b2-824a-4acc-a030-01acce938dab/3209de1bca814ac48884e015277360fd.pptx
|
||||
fileName := fileUrl[strings.LastIndex(fileUrl, "/")+1:]
|
||||
//文件保存路径
|
||||
path := service.GetFilePath(proto.FILE_BASE_DIR)
|
||||
saveFile := path + "/" + fileName
|
||||
path_ := service.GetFilePath(proto.FILE_BASE_DIR)
|
||||
|
||||
//获取文件后缀
|
||||
fileSuffix := path.Ext(fileName)
|
||||
//生成文件名
|
||||
fileStoreName := uuid.NewString() + fileSuffix
|
||||
saveFile := path_ + "/" + fileStoreName
|
||||
//下载文件
|
||||
err := DownloadFile(fileUrl, saveFile)
|
||||
if err != nil {
|
||||
log.Println("Download file error:", err)
|
||||
return "", "", err
|
||||
}
|
||||
log.Println("Download file success:", fileName)
|
||||
return fileName, path, nil
|
||||
log.Println("Download file success:", fileStoreName)
|
||||
return fileStoreName, path_, nil
|
||||
}
|
||||
|
||||
func DownloadFile(url, filePath string) error {
|
||||
|
|
|
|||
Loading…
Reference in New Issue