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
5fb57526
Unverified
Commit
5fb57526
authored
Mar 19, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12676 目录生成
parent
84c5daf0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
src/main/java/org/b3log/solo/service/ExportService.java
src/main/java/org/b3log/solo/service/ExportService.java
+27
-7
No files found.
src/main/java/org/b3log/solo/service/ExportService.java
View file @
5fb57526
...
@@ -190,27 +190,47 @@ public class ExportService {
...
@@ -190,27 +190,47 @@ public class ExportService {
bodyBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
bodyBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
articleIds
.
add
(
article
.
optString
(
Keys
.
OBJECT_ID
));
articleIds
.
add
(
article
.
optString
(
Keys
.
OBJECT_ID
));
}
}
bodyBuilder
.
append
(
"\n\n热门\n\n"
);
bodyBuilder
.
append
(
"\n\n"
);
final
List
<
JSONObject
>
mostViewArticles
=
articleRepository
.
getList
(
new
Query
().
select
(
Keys
.
OBJECT_ID
,
Article
.
ARTICLE_TITLE
,
Article
.
ARTICLE_PERMALINK
).
addSort
(
Article
.
ARTICLE_VIEW_COUNT
,
SortDirection
.
DESCENDING
).
setPage
(
1
,
20
));
final
StringBuilder
mostViewBuilder
=
new
StringBuilder
();
final
List
<
JSONObject
>
mostViewArticles
=
articleRepository
.
getList
(
new
Query
().
select
(
Keys
.
OBJECT_ID
,
Article
.
ARTICLE_TITLE
,
Article
.
ARTICLE_PERMALINK
).
addSort
(
Article
.
ARTICLE_VIEW_COUNT
,
SortDirection
.
DESCENDING
).
setPage
(
1
,
40
));
int
count
=
0
;
for
(
final
JSONObject
article
:
mostViewArticles
)
{
for
(
final
JSONObject
article
:
mostViewArticles
)
{
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
if
(!
articleIds
.
contains
(
articleId
))
{
if
(!
articleIds
.
contains
(
articleId
))
{
final
String
title
=
article
.
optString
(
Article
.
ARTICLE_TITLE
);
final
String
title
=
article
.
optString
(
Article
.
ARTICLE_TITLE
);
final
String
link
=
Latkes
.
getServePath
()
+
article
.
optString
(
Article
.
ARTICLE_PERMALINK
);
final
String
link
=
Latkes
.
getServePath
()
+
article
.
optString
(
Article
.
ARTICLE_PERMALINK
);
bodyBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
mostViewBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
articleIds
.
add
(
articleId
);
count
++;
}
}
if
(
20
<=
count
)
{
break
;
}
}
if
(
0
<
mostViewBuilder
.
length
())
{
bodyBuilder
.
append
(
"热门\n\n"
).
append
(
mostViewBuilder
).
append
(
"\n\n"
);
}
}
bodyBuilder
.
append
(
"\n\n热议\n\n"
);
final
List
<
JSONObject
>
mostCmtArticles
=
articleRepository
.
getList
(
new
Query
().
select
(
Keys
.
OBJECT_ID
,
Article
.
ARTICLE_TITLE
,
Article
.
ARTICLE_PERMALINK
).
addSort
(
Article
.
ARTICLE_COMMENT_COUNT
,
SortDirection
.
DESCENDING
).
setPage
(
1
,
20
));
final
StringBuilder
mostCmtBuilder
=
new
StringBuilder
();
final
List
<
JSONObject
>
mostCmtArticles
=
articleRepository
.
getList
(
new
Query
().
select
(
Keys
.
OBJECT_ID
,
Article
.
ARTICLE_TITLE
,
Article
.
ARTICLE_PERMALINK
).
addSort
(
Article
.
ARTICLE_COMMENT_COUNT
,
SortDirection
.
DESCENDING
).
setPage
(
1
,
60
));
count
=
0
;
for
(
final
JSONObject
article
:
mostCmtArticles
)
{
for
(
final
JSONObject
article
:
mostCmtArticles
)
{
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
if
(!
articleIds
.
contains
(
articleId
))
{
if
(!
articleIds
.
contains
(
articleId
))
{
final
String
title
=
article
.
optString
(
Article
.
ARTICLE_TITLE
);
final
String
title
=
article
.
optString
(
Article
.
ARTICLE_TITLE
);
final
String
link
=
Latkes
.
getServePath
()
+
article
.
optString
(
Article
.
ARTICLE_PERMALINK
);
final
String
link
=
Latkes
.
getServePath
()
+
article
.
optString
(
Article
.
ARTICLE_PERMALINK
);
bodyBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
mostCmtBuilder
.
append
(
"\n* ["
).
append
(
title
).
append
(
"]("
).
append
(
link
).
append
(
")"
);
articleIds
.
add
(
articleId
);
count
++;
}
if
(
20
<=
count
)
{
break
;
}
}
}
}
bodyBuilder
.
append
(
"\n\n"
);
if
(
0
<
mostCmtBuilder
.
length
())
{
bodyBuilder
.
append
(
"热议\n\n"
).
append
(
mostCmtBuilder
).
append
(
"\n\n"
);
}
final
HttpResponse
response
=
HttpRequest
.
post
(
"http://localhost:8080/github/repos"
).
connectionTimeout
(
7000
).
timeout
(
60000
).
header
(
"User-Agent"
,
Solos
.
USER_AGENT
).
final
HttpResponse
response
=
HttpRequest
.
post
(
"http://localhost:8080/github/repos"
).
connectionTimeout
(
7000
).
timeout
(
60000
).
header
(
"User-Agent"
,
Solos
.
USER_AGENT
).
form
(
"userName"
,
userName
,
form
(
"userName"
,
userName
,
...
...
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