mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-08-10 00:11:38 +08:00
sitemap条目增加过滤条件
This commit is contained in:
parent
b60f8fe485
commit
13873dcb0b
@ -4,6 +4,7 @@
|
|||||||
- 更新自动安装脚本
|
- 更新自动安装脚本
|
||||||
- 优化登录/注册/忘记密码页
|
- 优化登录/注册/忘记密码页
|
||||||
- 修复移动端首页课程缓存刷新
|
- 修复移动端首页课程缓存刷新
|
||||||
|
- sitemap条目增加过滤条件
|
||||||
|
|
||||||
### [v1.5.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.7)(2022-08-18)
|
### [v1.5.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.7)(2022-08-18)
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ class SitemapTask extends Task
|
|||||||
|
|
||||||
$filename = tmp_path('sitemap.xml');
|
$filename = tmp_path('sitemap.xml');
|
||||||
|
|
||||||
|
echo '------ start sitemap task ------' . PHP_EOL;
|
||||||
|
|
||||||
$this->addIndex();
|
$this->addIndex();
|
||||||
$this->addCourses();
|
$this->addCourses();
|
||||||
$this->addArticles();
|
$this->addArticles();
|
||||||
@ -50,6 +52,8 @@ class SitemapTask extends Task
|
|||||||
$this->addOthers();
|
$this->addOthers();
|
||||||
|
|
||||||
$this->sitemap->build($filename);
|
$this->sitemap->build($filename);
|
||||||
|
|
||||||
|
echo '------ end sitemap task ------' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSiteUrl()
|
protected function getSiteUrl()
|
||||||
@ -73,6 +77,7 @@ class SitemapTask extends Task
|
|||||||
*/
|
*/
|
||||||
$courses = CourseModel::query()
|
$courses = CourseModel::query()
|
||||||
->where('published = 1')
|
->where('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
->orderBy('id DESC')
|
->orderBy('id DESC')
|
||||||
->limit(500)
|
->limit(500)
|
||||||
->execute();
|
->execute();
|
||||||
@ -92,6 +97,7 @@ class SitemapTask extends Task
|
|||||||
*/
|
*/
|
||||||
$articles = ArticleModel::query()
|
$articles = ArticleModel::query()
|
||||||
->where('published = :published:', ['published' => ArticleModel::PUBLISH_APPROVED])
|
->where('published = :published:', ['published' => ArticleModel::PUBLISH_APPROVED])
|
||||||
|
->andWhere('deleted = 0')
|
||||||
->orderBy('id DESC')
|
->orderBy('id DESC')
|
||||||
->limit(500)
|
->limit(500)
|
||||||
->execute();
|
->execute();
|
||||||
@ -111,6 +117,7 @@ class SitemapTask extends Task
|
|||||||
*/
|
*/
|
||||||
$questions = QuestionModel::query()
|
$questions = QuestionModel::query()
|
||||||
->where('published = :published:', ['published' => QuestionModel::PUBLISH_APPROVED])
|
->where('published = :published:', ['published' => QuestionModel::PUBLISH_APPROVED])
|
||||||
|
->andWhere('deleted = 0')
|
||||||
->orderBy('id DESC')
|
->orderBy('id DESC')
|
||||||
->limit(500)
|
->limit(500)
|
||||||
->execute();
|
->execute();
|
||||||
@ -128,7 +135,10 @@ class SitemapTask extends Task
|
|||||||
/**
|
/**
|
||||||
* @var Resultset|UserModel[] $teachers
|
* @var Resultset|UserModel[] $teachers
|
||||||
*/
|
*/
|
||||||
$teachers = UserModel::query()->where('edu_role = 2')->execute();
|
$teachers = UserModel::query()
|
||||||
|
->where('edu_role = :edu_role:', ['edu_role' => UserModel::EDU_ROLE_TEACHER])
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->execute();
|
||||||
|
|
||||||
if ($teachers->count() == 0) return;
|
if ($teachers->count() == 0) return;
|
||||||
|
|
||||||
@ -143,7 +153,10 @@ class SitemapTask extends Task
|
|||||||
/**
|
/**
|
||||||
* @var Resultset|TopicModel[] $topics
|
* @var Resultset|TopicModel[] $topics
|
||||||
*/
|
*/
|
||||||
$topics = TopicModel::query()->where('published = 1')->execute();
|
$topics = TopicModel::query()
|
||||||
|
->where('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->execute();
|
||||||
|
|
||||||
if ($topics->count() == 0) return;
|
if ($topics->count() == 0) return;
|
||||||
|
|
||||||
@ -158,7 +171,10 @@ class SitemapTask extends Task
|
|||||||
/**
|
/**
|
||||||
* @var Resultset|PageModel[] $pages
|
* @var Resultset|PageModel[] $pages
|
||||||
*/
|
*/
|
||||||
$pages = PageModel::query()->where('published = 1')->execute();
|
$pages = PageModel::query()
|
||||||
|
->where('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->execute();
|
||||||
|
|
||||||
if ($pages->count() == 0) return;
|
if ($pages->count() == 0) return;
|
||||||
|
|
||||||
@ -173,7 +189,10 @@ class SitemapTask extends Task
|
|||||||
/**
|
/**
|
||||||
* @var Resultset|HelpModel[] $helps
|
* @var Resultset|HelpModel[] $helps
|
||||||
*/
|
*/
|
||||||
$helps = HelpModel::query()->where('published = 1')->execute();
|
$helps = HelpModel::query()
|
||||||
|
->where('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->execute();
|
||||||
|
|
||||||
if ($helps->count() == 0) return;
|
if ($helps->count() == 0) return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user