1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-13 03:49:11 +08:00

vip.js -> vip.index.js

This commit is contained in:
xiaochong0302 2023-12-11 12:38:47 +08:00
parent 28639f4ccd
commit 6cee04917c
2 changed files with 17 additions and 2 deletions

View File

@ -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")
*/

View File

@ -2,7 +2,7 @@
<div class="layui-card">
<div class="layui-card-header">推荐问题</div>
<div class="layui-card-body">
<div class="sidebar-question-list">
<div class="sidebar-article-list">
{% for question in questions %}
{% set question_url = url({'for':'home.question.show','id':question.id}) %}
<div class="title layui-elip">
@ -11,7 +11,7 @@
<div class="meta">
<span class="view">{{ question.view_count }} 浏览</span>
<span class="like">{{ question.like_count }} 点赞</span>
<span class="comment">{{ question.comment_count }} 评论</span>
<span class="answer">{{ question.answer_count }} 回答</span>
</div>
{% endfor %}
</div>