Commit eb69e76b authored by Liang Ding's avatar Liang Ding

#12633

parent 2188c8a7
......@@ -507,7 +507,7 @@ public class ArticleProcessor {
}
final JSONObject articlesResult = articleQueryService.getArticlesByAuthorId(authorId, currentPageNum, pageSize);
final List<JSONObject> articles = CollectionUtils.jsonArrayToList(articlesResult.optJSONArray(Keys.OBJECT_ID));
final List<JSONObject> articles = CollectionUtils.jsonArrayToList(articlesResult.optJSONArray(Keys.RESULTS));
dataModelService.setArticlesExProperties(context, articles, preference);
final int pageCount = articlesResult.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);
......@@ -568,7 +568,7 @@ public class ArticleProcessor {
return;
}
final List<JSONObject> articles = CollectionUtils.jsonArrayToList(articlesResult.optJSONArray(Keys.OBJECT_ID));
final List<JSONObject> articles = CollectionUtils.jsonArrayToList(articlesResult.optJSONArray(Keys.RESULTS));
dataModelService.setArticlesExProperties(context, articles, preference);
final int pageCount = articlesResult.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);
final List<Integer> pageNums = Paginator.paginate(currentPageNum, pageSize, pageCount, windowSize);
......
......@@ -199,7 +199,6 @@ public class DataModelService {
if (Templates.hasExpression(template, "<#list articles1 as article>")) {
isArticles1 = true;
query.addSort(Article.ARTICLE_CREATED, SortDirection.DESCENDING);
LOGGER.trace("Query ${articles1} in index.ftl");
} else { // <#list articles as article>
query.addSort(Article.ARTICLE_PUT_TOP, SortDirection.DESCENDING);
......@@ -220,11 +219,9 @@ public class DataModelService {
dataModel.put(Pagination.PAGINATION_FIRST_PAGE_NUM, pageNums.get(0));
dataModel.put(Pagination.PAGINATION_LAST_PAGE_NUM, pageNums.get(pageNums.size() - 1));
}
dataModel.put(Pagination.PAGINATION_PAGE_COUNT, pageCount);
dataModel.put(Pagination.PAGINATION_PAGE_NUMS, pageNums);
if (!isArticles1) {
dataModel.put(Article.ARTICLES, articles);
} else {
......
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