diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php index f360db8f..9ac60365 100644 --- a/app/Console/Tasks/MaintainTask.php +++ b/app/Console/Tasks/MaintainTask.php @@ -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; } /** diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php index 6478ed18..350cb5ec 100644 --- a/app/Console/Tasks/Task.php +++ b/app/Console/Tasks/Task.php @@ -41,7 +41,7 @@ class Task extends \Phalcon\Cli\Task { $appService = new AppService(); - return $appService->getLogger($section); + return $appService->getSettings($section); } } diff --git a/app/Console/Tasks/UpgradeTask.php b/app/Console/Tasks/UpgradeTask.php index 13bb53fb..8700703d 100644 --- a/app/Console/Tasks/UpgradeTask.php +++ b/app/Console/Tasks/UpgradeTask.php @@ -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); }