Skip to content

Commit 722ad31

Browse files
author
piexlmax
committed
fixed: #862
1 parent 7a6939e commit 722ad31

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

server/api/v1/example/exa_breakpoint_continue.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package example
22

33
import (
44
"fmt"
5+
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
56
"io/ioutil"
67
"mime/multipart"
78
"strconv"
@@ -123,11 +124,17 @@ func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) {
123124
// @Success 200 {string} string "{"success":true,"data":{},"msg":"缓存切片删除成功"}"
124125
// @Router /fileUploadAndDownload/removeChunk [post]
125126
func (u *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) {
126-
fileMd5 := c.Query("fileMd5")
127-
err := utils.RemoveChunk(fileMd5)
127+
var file example.ExaFile
128+
c.ShouldBindJSON(&file)
129+
err := utils.RemoveChunk(file.FileMd5)
130+
if err != nil {
131+
response.FailWithMessage(err.Error(), c)
132+
return
133+
}
134+
err = fileUploadAndDownloadService.DeleteFileChunk(file.FileMd5, file.FileName, file.FilePath)
128135
if err != nil {
129-
global.GVA_LOG.Error("缓存切片删除失败!", zap.Error(err))
130-
response.FailWithMessage( "缓存切片删除失败", c)
136+
global.GVA_LOG.Error(err.Error(), zap.Error(err))
137+
response.FailWithMessage(err.Error(), c)
131138
} else {
132139
response.OkWithMessage("缓存切片删除成功", c)
133140
}

server/service/example/exa_breakpoint_continue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (e *FileUploadAndDownloadService) CreateFileChunk(id uint, fileChunkPath st
5656
func (e *FileUploadAndDownloadService) DeleteFileChunk(fileMd5 string, fileName string, filePath string) error {
5757
var chunks []example.ExaFileChunk
5858
var file example.ExaFile
59-
err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", fileMd5, fileName).First(&file).Update("IsFinish", true).Update("file_path", filePath).Error
59+
err := global.GVA_DB.Where("file_md5 = ? ", fileMd5).First(&file).Update("IsFinish", true).Update("file_path", filePath).Error
6060
if err != nil {
6161
return err
6262
}

web/src/view/example/breakpoint/breakpoint.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,11 @@ const upLoadFileSlice = async(item) => {
160160
if (res.code === 0) {
161161
// 合成文件过后 删除缓存切片
162162
const params = {
163+
fileName: file.value.name,
163164
fileMd5: fileMd5.value,
165+
filePath: res.data.filePath,
164166
}
165-
ElMessage.success(上传成功)
167+
ElMessage.success("上传成功")
166168
await removeChunk(params)
167169
}
168170
}

0 commit comments

Comments
 (0)