Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
solo-1
Commits
4a4c0159
Unverified
Commit
4a4c0159
authored
Apr 23, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
导入 Markdown 文件存档时间问题 Fix #112
parent
c113deb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/main/java/org/b3log/solo/service/ImportService.java
src/main/java/org/b3log/solo/service/ImportService.java
+6
-2
No files found.
src/main/java/org/b3log/solo/service/ImportService.java
View file @
4a4c0159
...
@@ -35,7 +35,7 @@ import java.util.*;
...
@@ -35,7 +35,7 @@ import java.util.*;
* Import service.
* Import service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.6,
Nov 22, 2019
* @version 1.0.1.6,
Apr 23, 2020
* @since 2.2.0
* @since 2.2.0
*/
*/
@Service
@Service
...
@@ -92,7 +92,7 @@ public class ImportService {
...
@@ -92,7 +92,7 @@ public class ImportService {
int
succCnt
=
0
,
failCnt
=
0
;
int
succCnt
=
0
,
failCnt
=
0
;
final
Set
<
String
>
failSet
=
new
TreeSet
<>();
final
Set
<
String
>
failSet
=
new
TreeSet
<>();
final
Collection
<
File
>
mds
=
FileUtils
.
listFiles
(
markdownsPath
,
new
String
[]{
"md"
},
true
);
final
Collection
<
File
>
mds
=
FileUtils
.
listFiles
(
markdownsPath
,
new
String
[]{
"md"
},
true
);
if
(
null
==
mds
||
mds
.
isEmpty
())
{
if
(
mds
.
isEmpty
())
{
return
;
return
;
}
}
...
@@ -187,6 +187,10 @@ public class ImportService {
...
@@ -187,6 +187,10 @@ public class ImportService {
final
Date
date
=
parseDate
(
elems
);
final
Date
date
=
parseDate
(
elems
);
ret
.
put
(
Article
.
ARTICLE_CREATED
,
date
.
getTime
());
ret
.
put
(
Article
.
ARTICLE_CREATED
,
date
.
getTime
());
// 文章 id 必须使用存档时间戳,否则生成的存档时间会是当前时间
// 导入 Markdown 文件存档时间问题 https://github.com/88250/solo/issues/112
ret
.
put
(
Keys
.
OBJECT_ID
,
String
.
valueOf
(
date
.
getTime
()));
final
String
permalink
=
(
String
)
elems
.
get
(
"permalink"
);
final
String
permalink
=
(
String
)
elems
.
get
(
"permalink"
);
if
(
StringUtils
.
isNotBlank
(
permalink
))
{
if
(
StringUtils
.
isNotBlank
(
permalink
))
{
ret
.
put
(
Article
.
ARTICLE_PERMALINK
,
permalink
);
ret
.
put
(
Article
.
ARTICLE_PERMALINK
,
permalink
);
...
...
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