mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 20:06:09 +08:00
!10 命令行工具rebuild_index_course_cache增加type=simple逻辑
Merge pull request !10 from koogua/koogua/I1Y8EB
This commit is contained in:
commit
823e47f6b2
@ -4,6 +4,9 @@ namespace App\Console\Tasks;
|
||||
|
||||
use App\Caches\IndexFreeCourseList as IndexFreeCourseListCache;
|
||||
use App\Caches\IndexNewCourseList as IndexNewCourseListCache;
|
||||
use App\Caches\IndexSimpleFreeCourseList as IndexSimpleFreeCourseListCache;
|
||||
use App\Caches\IndexSimpleNewCourseList as IndexSimpleNewCourseListCache;
|
||||
use App\Caches\IndexSimpleVipCourseList as IndexSimpleVipCourseListCache;
|
||||
use App\Caches\IndexVipCourseList as IndexVipCourseListCache;
|
||||
use App\Http\Admin\Services\Setting as SettingService;
|
||||
use App\Library\Utils\Password as PasswordUtil;
|
||||
@ -22,20 +25,41 @@ class MaintainTask extends Task
|
||||
{
|
||||
$section = $params[0] ?? null;
|
||||
|
||||
$site = $this->getSettings('site');
|
||||
|
||||
$type = $site['index_tpl_type'] ?: 'full';
|
||||
|
||||
if (!$section || $section == 'new_course') {
|
||||
$cache = new IndexNewCourseListCache();
|
||||
$cache->rebuild();
|
||||
if ($type == 'full') {
|
||||
$cache = new IndexNewCourseListCache();
|
||||
$cache->rebuild();
|
||||
} else {
|
||||
$cache = new IndexSimpleNewCourseListCache();
|
||||
$cache->rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$section || $section == 'free_course') {
|
||||
$cache = new IndexFreeCourseListCache();
|
||||
$cache->rebuild();
|
||||
if ($type == 'full') {
|
||||
$cache = new IndexFreeCourseListCache();
|
||||
$cache->rebuild();
|
||||
} else {
|
||||
$cache = new IndexSimpleFreeCourseListCache();
|
||||
$cache->rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$section || $section == 'vip_course') {
|
||||
$cache = new IndexVipCourseListCache();
|
||||
$cache->rebuild();
|
||||
if ($type == 'full') {
|
||||
$cache = new IndexVipCourseListCache();
|
||||
$cache->rebuild();
|
||||
} else {
|
||||
$cache = new IndexSimpleVipCourseListCache();
|
||||
$cache->rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
echo 'rebuild index course cache success' . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ class Task extends \Phalcon\Cli\Task
|
||||
{
|
||||
$appService = new AppService();
|
||||
|
||||
return $appService->getLogger($section);
|
||||
return $appService->getSettings($section);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ class UpgradeTask extends Task
|
||||
public function resetAnnotationAction()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$dbIndex = $config->path('annotation.db');
|
||||
@ -56,9 +55,7 @@ class UpgradeTask extends Task
|
||||
echo "start reset annotation..." . PHP_EOL;
|
||||
|
||||
if (count($keys) > 0) {
|
||||
|
||||
$keys = $this->handlePhKeys($keys);
|
||||
|
||||
$redis->del(...$keys);
|
||||
$redis->del($statsKey);
|
||||
}
|
||||
@ -74,7 +71,6 @@ class UpgradeTask extends Task
|
||||
public function resetMetadataAction()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$dbIndex = $config->path('metadata.db');
|
||||
@ -87,9 +83,7 @@ class UpgradeTask extends Task
|
||||
echo "start reset metadata..." . PHP_EOL;
|
||||
|
||||
if (count($keys) > 0) {
|
||||
|
||||
$keys = $this->handlePhKeys($keys);
|
||||
|
||||
$redis->del(...$keys);
|
||||
$redis->del($statsKey);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user