Commit 9fbebd18 authored by Liang Ding's avatar Liang Ding

:octocat: 加入一些统计元数据

parent 97428dbb
......@@ -51,7 +51,7 @@ import java.util.stream.Collectors;
* Export service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.1, Sep 18, 2019
* @version 1.1.1.2, Nov 13, 2019
* @since 2.5.0
*/
@Service
......@@ -146,6 +146,24 @@ public class ExportService {
@Inject
private OptionQueryService optionQueryService;
/**
* Article query service.
*/
@Inject
private ArticleQueryService articleQueryService;
/**
* Statistic query service.
*/
@Inject
private StatisticQueryService statisticQueryService;
/**
* Tag query service.
*/
@Inject
private TagQueryService tagQueryService;
/**
* Exports public articles to admin's GitHub repos. 博文定时同步 GitHub 仓库 https://hacpai.com/article/1557238327458
*/
......@@ -248,6 +266,14 @@ public class ExportService {
bodyBuilder.append("### 热议\n").append(mostCmtBuilder);
}
final JSONObject stat = new JSONObject();
stat.put("recentArticleTime", articleQueryService.getRecentArticleTime());
final JSONObject statistic = statisticQueryService.getStatistic();
stat.put("articleCount", statistic.getLong(Option.ID_T_STATISTIC_PUBLISHED_ARTICLE_COUNT));
stat.put("commentCount", statistic.getLong(Option.ID_T_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT));
stat.put("tagCount", tagQueryService.getTagCount());
stat.put("favicon", preference.optString(Option.ID_C_FAVICON_URL));
final HttpResponse response = HttpRequest.post("https://hacpai.com/github/repos").
connectionTimeout(7000).timeout(60000).trustAllCerts(true).header("User-Agent", Solos.USER_AGENT).
form("userName", userName,
......@@ -259,6 +285,7 @@ public class ExportService {
"clientTitle", clientTitle,
"clientSubtitle", clientSubtitle,
"clientBody", bodyBuilder.toString(),
"stat", stat.toString(),
"file", zipData).send();
response.close();
response.charset("UTF-8");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment