1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-25 04:07:17 +08:00

增加刷新首页推荐课程缓存逻辑

This commit is contained in:
xiaochong0302 2020-12-29 15:52:45 +08:00
parent f3f0ca4e5f
commit 1ff7aa3be6

View File

@ -2,8 +2,10 @@
namespace App\Services\Utils;
use App\Caches\IndexFeaturedCourseList as IndexFeaturedCourseListCache;
use App\Caches\IndexFreeCourseList as IndexFreeCourseListCache;
use App\Caches\IndexNewCourseList as IndexNewCourseListCache;
use App\Caches\IndexSimpleFeaturedCourseList as IndexSimpleFeaturedCourseListCache;
use App\Caches\IndexSimpleFreeCourseList as IndexSimpleFreeCourseListCache;
use App\Caches\IndexSimpleNewCourseList as IndexSimpleNewCourseListCache;
use App\Caches\IndexSimpleVipCourseList as IndexSimpleVipCourseListCache;
@ -19,6 +21,16 @@ class IndexCourseCache extends Service
$type = $site['index_tpl_type'] ?: 'full';
if (!$section || $section == 'featured_course') {
if ($type == 'full') {
$cache = new IndexFeaturedCourseListCache();
$cache->rebuild();
} else {
$cache = new IndexSimpleFeaturedCourseListCache();
$cache->rebuild();
}
}
if (!$section || $section == 'new_course') {
if ($type == 'full') {
$cache = new IndexNewCourseListCache();