mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-22 11:41:27 +08:00
优化热门作者,答主和问题
This commit is contained in:
parent
301557abbc
commit
46176071b8
@ -4,7 +4,7 @@
|
||||
|
||||
{% set sort_val = request.get('sort','trim','latest') %}
|
||||
{% set pager_url = url({'for':'home.article.pager'}, params) %}
|
||||
{% set top_authors_url = url({'for':'home.widget.top_authors'}) %}
|
||||
{% set top_authors_url = url({'for':'home.widget.top_authors'},{'limit':5}) %}
|
||||
{% set my_tags_url = url({'for':'home.widget.my_tags'},{'type':'article'}) %}
|
||||
|
||||
<div class="breadcrumb">
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
{% set sort_val = request.get('sort','trim','latest') %}
|
||||
{% set pager_url = url({'for':'home.question.pager'}, params) %}
|
||||
{% set hot_questions_url = url({'for':'home.widget.hot_questions'}) %}
|
||||
{% set top_answerers_url = url({'for':'home.widget.top_answerers'}) %}
|
||||
{% set hot_questions_url = url({'for':'home.widget.hot_questions'},{'limit':10}) %}
|
||||
{% set top_answerers_url = url({'for':'home.widget.top_answerers'},{'limit':5}) %}
|
||||
{% set my_tags_url = url({'for':'home.widget.my_tags'},{'type':'question'}) %}
|
||||
|
||||
<div class="breadcrumb">
|
||||
|
@ -15,11 +15,17 @@ class TopAuthorList extends LogicService
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$limit = $this->request->getQuery('limit', 'int', 10);
|
||||
|
||||
$cache = new TopAuthorListCache();
|
||||
|
||||
$result = $cache->get();
|
||||
$list = $cache->get();
|
||||
|
||||
return $result ?: [];
|
||||
if($limit < count($list)) {
|
||||
$list = array_slice($list, $limit);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,11 +15,17 @@ class HotQuestionList extends LogicService
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$limit = $this->request->getQuery('limit', 'int', 10);
|
||||
|
||||
$cache = new HotQuestionListCache();
|
||||
|
||||
$result = $cache->get();
|
||||
$list = $cache->get();
|
||||
|
||||
return $result ?: [];
|
||||
if($limit < count($list)) {
|
||||
$list = array_slice($list, $limit);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,11 +15,17 @@ class TopAnswererList extends LogicService
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$limit = $this->request->getQuery('limit', 'int', 10);
|
||||
|
||||
$cache = new TopAnswererListCache();
|
||||
|
||||
$result = $cache->get();
|
||||
$list = $cache->get();
|
||||
|
||||
return $result ?: [];
|
||||
if($limit < count($list)) {
|
||||
$list = array_slice($list, $limit);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user