|
@@ -53,8 +53,8 @@ func (c *Conversion) ToConversion() {
|
|
|
}
|
|
|
}
|
|
|
//写入文件
|
|
|
- inputFilename := fmt.Sprintf("%s/%s.%s", filePath, c.FileId, c.Suffix)
|
|
|
- file, err := os.Create(inputFilename)
|
|
|
+ inputFile := fmt.Sprintf("%s/%s.%s", filePath, c.FileId, c.Suffix)
|
|
|
+ file, err := os.Create(inputFile)
|
|
|
if err != nil {
|
|
|
fmt.Println("Error creating file:", err)
|
|
|
return
|
|
@@ -73,7 +73,7 @@ func (c *Conversion) ToConversion() {
|
|
|
return
|
|
|
}
|
|
|
// 开始执行转换
|
|
|
- cmd := exec.Command("unoconv", "-f", fileSuffix, inputFilename)
|
|
|
+ cmd := exec.Command("unoconv", "-f", fileSuffix, inputFile)
|
|
|
cmd.Stdout = nil
|
|
|
cmd.Stderr = nil
|
|
|
err = cmd.Run()
|
|
@@ -103,6 +103,9 @@ func (c *Conversion) ToConversion() {
|
|
|
if fileRes.OssDocId == "" {
|
|
|
fmt.Println(" upload oss err:", fileRes.Msg)
|
|
|
} else {
|
|
|
+ //移除文件
|
|
|
+ os.Remove(inputFile)
|
|
|
+ os.Remove(pdfFile)
|
|
|
if err = partner.DocsUpdate(2, model.Doc{
|
|
|
Id: c.DocId,
|
|
|
OssPdfId: fmt.Sprintf("%s.%s", c.FileId, fileSuffix),
|