diff --git a/app/Http/Home/Controllers/WidgetController.php b/app/Http/Home/Controllers/WidgetController.php index 1d558745..f7dd3843 100644 --- a/app/Http/Home/Controllers/WidgetController.php +++ b/app/Http/Home/Controllers/WidgetController.php @@ -9,6 +9,7 @@ namespace App\Http\Home\Controllers; use App\Caches\FeaturedArticleList as FeaturedArticleListCache; use App\Caches\FeaturedCourseList as FeaturedCourseListCache; +use App\Caches\FeaturedQuestionList as FeaturedQuestionListCache; use App\Services\Logic\Article\TopAuthorList as TopAuthorListService; use App\Services\Logic\Question\HotQuestionList as HotQuestionListService; use App\Services\Logic\Question\TopAnswererList as TopAnswererListService; @@ -63,6 +64,20 @@ class WidgetController extends Controller $this->view->setVar('articles', $articles); } + /** + * @Get("/featured/questions", name="home.widget.featured_questions") + */ + public function featuredQuestionsAction() + { + $cache = new FeaturedQuestionListCache(); + + $questions = $cache->get(); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + $this->view->pick('widget/featured_questions'); + $this->view->setVar('questions', $questions); + } + /** * @Get("/hot/questions", name="home.widget.hot_questions") */ diff --git a/app/Http/Home/Views/widget/featured_questions.volt b/app/Http/Home/Views/widget/featured_questions.volt index 4aad80ce..ca4a2d0b 100644 --- a/app/Http/Home/Views/widget/featured_questions.volt +++ b/app/Http/Home/Views/widget/featured_questions.volt @@ -2,7 +2,7 @@
推荐问题
-