Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
6bd35351
Commit
6bd35351
authored
Jan 01, 2022
by
coderTomato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改前端上传失败的返回值
parent
2494d9b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
CatalogueController.java
...c/main/java/com/dlink/controller/CatalogueController.java
+3
-7
UploadModal.tsx
...c/components/Studio/StudioTree/components/UploadModal.tsx
+1
-1
No files found.
dlink-admin/src/main/java/com/dlink/controller/CatalogueController.java
View file @
6bd35351
...
@@ -10,7 +10,6 @@ import com.dlink.service.CatalogueService;
...
@@ -10,7 +10,6 @@ import com.dlink.service.CatalogueService;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.io.*
;
...
@@ -31,18 +30,15 @@ public class CatalogueController {
...
@@ -31,18 +30,15 @@ public class CatalogueController {
@Autowired
@Autowired
private
CatalogueService
catalogueService
;
private
CatalogueService
catalogueService
;
@Value
(
"${dlink.uploadpath}"
)
private
String
uploadpath
;
@PostMapping
(
"/upload/{id}"
)
@PostMapping
(
"/upload/{id}"
)
public
Result
<
String
>
upload
(
MultipartFile
file
,
@PathVariable
Integer
id
)
{
public
Result
<
String
>
upload
(
MultipartFile
file
,
@PathVariable
Integer
id
)
{
//获取上传的路径
//获取上传的路径
String
filePath
=
uploadpath
;
String
filePath
=
System
.
getProperty
(
"user.dir"
)
;
//获取源文件的名称
//获取源文件的名称
String
fileName
=
file
.
getOriginalFilename
();
String
fileName
=
file
.
getOriginalFilename
();
String
zipPath
=
filePath
+
fileName
;
String
zipPath
=
filePath
+
File
.
separator
+
fileName
;
String
unzipFileName
=
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
"."
));
String
unzipFileName
=
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
"."
));
String
unzipPath
=
filePath
+
unzipFileName
;
String
unzipPath
=
filePath
+
File
.
separator
+
unzipFileName
;
File
unzipFile
=
new
File
(
unzipPath
);
File
unzipFile
=
new
File
(
unzipPath
);
File
zipFile
=
new
File
(
zipPath
);
File
zipFile
=
new
File
(
zipPath
);
if
(
unzipFile
.
exists
()){
if
(
unzipFile
.
exists
()){
...
...
dlink-web/src/components/Studio/StudioTree/components/UploadModal.tsx
View file @
6bd35351
...
@@ -23,7 +23,7 @@ const UploadModal:React.FC<UploadModalProps> = (props:any) => {
...
@@ -23,7 +23,7 @@ const UploadModal:React.FC<UploadModalProps> = (props:any) => {
}
}
if
(
info
.
file
.
status
===
'done'
)
{
if
(
info
.
file
.
status
===
'done'
)
{
console
.
log
(
'info:'
,
info
);
console
.
log
(
'info:'
,
info
);
if
(
info
.
file
.
response
.
code
==
"-1"
){
if
(
info
.
file
.
response
.
code
==
=
1
){
message
.
error
(
`
${
info
.
file
.
response
.
msg
}
`
);
message
.
error
(
`
${
info
.
file
.
response
.
msg
}
`
);
}
else
{
}
else
{
message
.
success
(
`
${
info
.
file
.
name
}
file uploaded successfully`
);
message
.
success
(
`
${
info
.
file
.
name
}
file uploaded successfully`
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment