修复file上传未设置到用户
This commit is contained in:
parent
af76f6b50d
commit
05e40343b5
|
|
@ -257,6 +257,13 @@ func UploadFileV2(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, gin.H{"error": "save file info failed", "code": proto.SaveFileInfoFailed, "message": "failed"})
|
||||
return
|
||||
}
|
||||
//添加用户文件
|
||||
fileAuth := service.CreateUserFile(id1, file_record.FileName, int(file_record.ID), uploadType)
|
||||
if fileAuth.ID != 0 {
|
||||
c.JSON(http.StatusOK, gin.H{"error": "save user file info failed", "code": proto.SaveFileInfoFailed, "message": "failed"})
|
||||
return
|
||||
}
|
||||
|
||||
file_record.FilePath = ""
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": file_record})
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": file_record, "file_auth": fileAuth})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,3 +242,8 @@ func DeleteUserFile(userID, fileAuthID int) error {
|
|||
err := dao.DeleteFileAuthByID(fileAuthID)
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateUserFile(userID int, fileAuthName string, fileID int, UploadType string) dao.FileAuth {
|
||||
fileAuth := dao.CreateFileAuth(userID, fileID, fileAuthName, UploadType, 1, "")
|
||||
return fileAuth
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue