diff --git a/app/Console/Tasks/RenewLiveCourseDemoTask.php b/app/Console/Tasks/RenewLiveCourseDemoTask.php new file mode 100644 index 00000000..18c9d516 --- /dev/null +++ b/app/Console/Tasks/RenewLiveCourseDemoTask.php @@ -0,0 +1,65 @@ +findById(1393); + + $chapters = $courseRepo->findLessons($course->id); + + $chapterRepo = new ChapterRepo(); + + foreach ($chapters as $chapter) { + + $live = $chapterRepo->findChapterLive($chapter->id); + + if ($live->start_time > time()) { + continue; + } + + $startTime = strtotime('+1 month', $live->start_time); + $endTime = strtotime('+1 month', $live->end_time); + + $live->start_time = $startTime; + $live->end_time = $endTime; + + $live->update(); + + $attrs = $chapter->attrs; + + $attrs['start_time'] = $startTime; + $attrs['end_time'] = $endTime; + + $chapter->attrs = $attrs; + + $chapter->update(); + } + + $statService = new CourseStatService(); + + $statService->updateLiveAttrs($course->id); + + $cache = new CourseChapterListCache(); + + $cache->rebuild($course->id); + } + +} diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index e8779d8e..6d2cce3a 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -101,7 +101,7 @@ class Setting extends Service */ if ($items->count() > 0) { foreach ($items as $item) { - $case1 = preg_match('/(id|auth|key|secret|password|pwd)$/', $item->item_key); + $case1 = preg_match('/(id|auth|key|secret|token|password|pwd)$/', $item->item_key); $case2 = $this->dispatcher->getControllerName() == 'setting'; if ($case1 && $case2) { $item->item_value = '***'; diff --git a/scheduler.php b/scheduler.php index f363c2e7..b1175a1b 100644 --- a/scheduler.php +++ b/scheduler.php @@ -52,4 +52,7 @@ $scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main']) $scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main']) ->daily(4, 3); +$scheduler->php($script, $bin, ['--task' => 'renew_live_course_demo', '--action' => 'main']) + ->daily(4, 7); + $scheduler->run(); \ No newline at end of file