Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SmartBox
Project
Overview
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
苗权威
SmartBox
Commits
ee773023
Commit
ee773023
authored
Sep 21, 2020
by
苗权威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.1.81:8000/Foxes/SmartBox
parents
5f5c5e2f
591240c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
26 deletions
+34
-26
DeployController.java
.../ai/qiwu/com/tts_service/controller/DeployController.java
+34
-26
No files found.
tts_service/src/main/java/ai/qiwu/com/tts_service/controller/DeployController.java
View file @
ee773023
...
...
@@ -79,33 +79,41 @@ public class DeployController {
String
targetBotAccount
=
requestBody
.
getString
(
"targetBotAccount"
);
String
tmpFileFullPathStr
=
Initialize
.
AUDIO_DIR
+
tmpFileRelativePathStr
;
Path
tmpFileFullPath
=
Paths
.
get
(
tmpFileFullPathStr
);
if
(
Files
.
exists
(
tmpFileFullPath
)
&&
!
Files
.
isDirectory
(
tmpFileFullPath
)
&&
StringUtils
.
endsWith
(
tmpFileRelativePathStr
,
".mp3"
)
&&
tmpFileRelativePathStr
.
startsWith
(
"/game_editor_tmp"
))
{
try
{
String
tmpFileRelativePathStr2
=
tmpFileRelativePathStr
.
substring
(
"/game_editor_tmp"
.
length
());
if
(
tmpFileRelativePathStr2
.
startsWith
(
File
.
separator
+
targetBotAccount
))
{
tmpFileRelativePathStr2
=
tmpFileRelativePathStr2
.
substring
((
File
.
separator
+
targetBotAccount
).
length
());
}
String
targetFileRelativePathStr
=
File
.
separator
+
targetBotAccount
+
tmpFileRelativePathStr2
;
String
targetFileFullPathStr
=
Initialize
.
AUDIO_DIR
+
targetFileRelativePathStr
;
Path
targetFileFullPath
=
Paths
.
get
(
targetFileFullPathStr
);
File
fileDistFile
=
new
File
(
targetFileFullPathStr
);
if
(!
fileDistFile
.
getParentFile
().
exists
())
{
fileDistFile
.
mkdirs
();
}
Files
.
move
(
tmpFileFullPath
,
targetFileFullPath
,
StandardCopyOption
.
REPLACE_EXISTING
);
FileUtil
.
deleteFile
(
new
File
(
tmpFileFullPathStr
));
return
ServerResponse
.
createBySuccess
(
targetFileRelativePathStr
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(!
Files
.
exists
(
tmpFileFullPath
)
&&
Files
.
isDirectory
(
tmpFileFullPath
)
)
{
ServerResponse
<
Object
>
result
=
ServerResponse
.
createByError
();
result
.
setMsg
(
"缓存文件不存在!"
);
log
.
error
(
tmpFileFullPath
.
toString
()+
"路径不存在,或者是目录"
);
return
result
;
}
return
ServerResponse
.
createByError
();
if
(!
StringUtils
.
endsWith
(
tmpFileRelativePathStr
,
".mp3"
)
&&
!
tmpFileRelativePathStr
.
startsWith
(
"/game_editor_tmp"
))
{
ServerResponse
<
Object
>
result
=
ServerResponse
.
createByError
();
result
.
setMsg
(
"地址前缀或者后缀有问题!"
);
log
.
error
(
tmpFileFullPath
.
toString
()+
"路径不存在,或者是目录"
);
return
result
;
}
try
{
String
tmpFileRelativePathStr2
=
tmpFileRelativePathStr
.
substring
(
"/game_editor_tmp"
.
length
());
if
(
tmpFileRelativePathStr2
.
startsWith
(
File
.
separator
+
targetBotAccount
))
{
tmpFileRelativePathStr2
=
tmpFileRelativePathStr2
.
substring
((
File
.
separator
+
targetBotAccount
).
length
());
}
String
targetFileRelativePathStr
=
File
.
separator
+
targetBotAccount
+
tmpFileRelativePathStr2
;
String
targetFileFullPathStr
=
Initialize
.
AUDIO_DIR
+
targetFileRelativePathStr
;
Path
targetFileFullPath
=
Paths
.
get
(
targetFileFullPathStr
);
File
fileDistFile
=
new
File
(
targetFileFullPathStr
);
if
(!
fileDistFile
.
getParentFile
().
exists
())
{
fileDistFile
.
mkdirs
();
}
Files
.
move
(
tmpFileFullPath
,
targetFileFullPath
,
StandardCopyOption
.
REPLACE_EXISTING
);
FileUtil
.
deleteFile
(
new
File
(
tmpFileFullPathStr
));
return
ServerResponse
.
createBySuccess
(
targetFileRelativePathStr
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"请求体:"
+
requestBody
);
return
ServerResponse
.
createByError
();
}
}
@GetMapping
(
"/background/audio"
)
...
...
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