1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-02 15:14:57 +08:00

1.优化vip页面

2.优化索引管理工具
This commit is contained in:
xiaochong0302 2025-04-05 17:09:24 +08:00
parent 4dbf594dca
commit 095e476fa5
5 changed files with 127 additions and 109 deletions

View File

@ -20,8 +20,6 @@ class ArticleIndexTask extends Task
* 搜索测试 * 搜索测试
* *
* @command: php console.php article_index search {query} * @command: php console.php article_index search {query}
* @param array $params
* @throws \XSException
*/ */
public function searchAction($params) public function searchAction($params)
{ {
@ -31,7 +29,9 @@ class ArticleIndexTask extends Task
exit('please special a query word' . PHP_EOL); exit('please special a query word' . PHP_EOL);
} }
$result = $this->searchArticles($query); $handler = new ArticleSearcher();
$result = $handler->search($query);
var_export($result); var_export($result);
} }
@ -42,24 +42,6 @@ class ArticleIndexTask extends Task
* @command: php console.php article_index clean * @command: php console.php article_index clean
*/ */
public function cleanAction() public function cleanAction()
{
$this->cleanArticleIndex();
}
/**
* 重建索引
*
* @command: php console.php article_index rebuild
*/
public function rebuildAction()
{
$this->rebuildArticleIndex();
}
/**
* 清空索引
*/
protected function cleanArticleIndex()
{ {
$handler = new ArticleSearcher(); $handler = new ArticleSearcher();
@ -74,8 +56,10 @@ class ArticleIndexTask extends Task
/** /**
* 重建索引 * 重建索引
*
* @command: php console.php article_index rebuild
*/ */
protected function rebuildArticleIndex() public function rebuildAction()
{ {
$articles = $this->findArticles(); $articles = $this->findArticles();
@ -83,7 +67,7 @@ class ArticleIndexTask extends Task
$handler = new ArticleSearcher(); $handler = new ArticleSearcher();
$documenter = new ArticleDocument(); $doc = new ArticleDocument();
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class ArticleIndexTask extends Task
$index->beginRebuild(); $index->beginRebuild();
foreach ($articles as $article) { foreach ($articles as $article) {
$document = $documenter->setDocument($article); $document = $doc->setDocument($article);
$index->add($document); $index->add($document);
} }
@ -102,17 +86,39 @@ class ArticleIndexTask extends Task
} }
/** /**
* 搜索文章 * 刷新索引缓存
* *
* @param string $query * @command: php console.php article_index flush_index
* @return array
* @throws \XSException
*/ */
protected function searchArticles($query) public function flushIndexAction()
{ {
$handler = new ArticleSearcher(); $handler = new ArticleSearcher();
return $handler->search($query); $index = $handler->getXS()->getIndex();
echo '------ start flush article index ------' . PHP_EOL;
$index->flushIndex();
echo '------ end flush article index ------' . PHP_EOL;
}
/**
* 刷新搜索日志
*
* @command: php console.php article_index flush_logging
*/
public function flushLoggingAction()
{
$handler = new ArticleSearcher();
$index = $handler->getXS()->getIndex();
echo '------ start flush article logging ------' . PHP_EOL;
$index->flushLogging();
echo '------ end flush article logging ------' . PHP_EOL;
} }
/** /**

View File

@ -20,8 +20,6 @@ class CourseIndexTask extends Task
* 搜索测试 * 搜索测试
* *
* @command: php console.php course_index search {query} * @command: php console.php course_index search {query}
* @param array $params
* @throws \XSException
*/ */
public function searchAction($params) public function searchAction($params)
{ {
@ -31,7 +29,9 @@ class CourseIndexTask extends Task
exit('please special a query word' . PHP_EOL); exit('please special a query word' . PHP_EOL);
} }
$result = $this->searchCourses($query); $handler = new CourseSearcher();
$result = $handler->search($query);
var_export($result); var_export($result);
} }
@ -42,24 +42,6 @@ class CourseIndexTask extends Task
* @command: php console.php course_index clean * @command: php console.php course_index clean
*/ */
public function cleanAction() public function cleanAction()
{
$this->cleanCourseIndex();
}
/**
* 重建索引
*
* @command: php console.php course_index rebuild
*/
public function rebuildAction()
{
$this->rebuildCourseIndex();
}
/**
* 清空索引
*/
protected function cleanCourseIndex()
{ {
$handler = new CourseSearcher(); $handler = new CourseSearcher();
@ -74,8 +56,10 @@ class CourseIndexTask extends Task
/** /**
* 重建索引 * 重建索引
*
* @command: php console.php course_index rebuild
*/ */
protected function rebuildCourseIndex() public function rebuildAction()
{ {
$courses = $this->findCourses(); $courses = $this->findCourses();
@ -83,7 +67,7 @@ class CourseIndexTask extends Task
$handler = new CourseSearcher(); $handler = new CourseSearcher();
$documenter = new CourseDocument(); $doc = new CourseDocument();
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class CourseIndexTask extends Task
$index->beginRebuild(); $index->beginRebuild();
foreach ($courses as $course) { foreach ($courses as $course) {
$document = $documenter->setDocument($course); $document = $doc->setDocument($course);
$index->add($document); $index->add($document);
} }
@ -102,17 +86,39 @@ class CourseIndexTask extends Task
} }
/** /**
* 搜索课程 * 刷新索引缓存
* *
* @param string $query * @command: php console.php course_index flush_index
* @return array
* @throws \XSException
*/ */
protected function searchCourses($query) public function flushIndexAction()
{ {
$handler = new CourseSearcher(); $handler = new CourseSearcher();
return $handler->search($query); $index = $handler->getXS()->getIndex();
echo '------ start flush course index ------' . PHP_EOL;
$index->flushIndex();
echo '------ end flush course index ------' . PHP_EOL;
}
/**
* 刷新搜索日志
*
* @command: php console.php course_index flush_logging
*/
public function flushLoggingAction()
{
$handler = new CourseSearcher();
$index = $handler->getXS()->getIndex();
echo '------ start flush course logging ------' . PHP_EOL;
$index->flushLogging();
echo '------ end flush course logging ------' . PHP_EOL;
} }
/** /**
@ -124,7 +130,7 @@ class CourseIndexTask extends Task
{ {
return CourseModel::query() return CourseModel::query()
->where('published = 1') ->where('published = 1')
->where('deleted = 0') ->andWhere('deleted = 0')
->execute(); ->execute();
} }

View File

@ -20,8 +20,6 @@ class QuestionIndexTask extends Task
* 搜索测试 * 搜索测试
* *
* @command: php console.php question_index search {query} * @command: php console.php question_index search {query}
* @param array $params
* @throws \XSException
*/ */
public function searchAction($params) public function searchAction($params)
{ {
@ -31,7 +29,9 @@ class QuestionIndexTask extends Task
exit('please special a query word' . PHP_EOL); exit('please special a query word' . PHP_EOL);
} }
$result = $this->searchQuestions($query); $handler = new QuestionSearcher();
$result = $handler->search($query);
var_export($result); var_export($result);
} }
@ -42,24 +42,6 @@ class QuestionIndexTask extends Task
* @command: php console.php question_index clean * @command: php console.php question_index clean
*/ */
public function cleanAction() public function cleanAction()
{
$this->cleanQuestionIndex();
}
/**
* 重建索引
*
* @command: php console.php question_index rebuild
*/
public function rebuildAction()
{
$this->rebuildQuestionIndex();
}
/**
* 清空索引
*/
protected function cleanQuestionIndex()
{ {
$handler = new QuestionSearcher(); $handler = new QuestionSearcher();
@ -74,8 +56,10 @@ class QuestionIndexTask extends Task
/** /**
* 重建索引 * 重建索引
*
* @command: php console.php question_index rebuild
*/ */
protected function rebuildQuestionIndex() public function rebuildAction()
{ {
$questions = $this->findQuestions(); $questions = $this->findQuestions();
@ -83,7 +67,7 @@ class QuestionIndexTask extends Task
$handler = new QuestionSearcher(); $handler = new QuestionSearcher();
$documenter = new QuestionDocument(); $doc = new QuestionDocument();
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class QuestionIndexTask extends Task
$index->beginRebuild(); $index->beginRebuild();
foreach ($questions as $question) { foreach ($questions as $question) {
$document = $documenter->setDocument($question); $document = $doc->setDocument($question);
$index->add($document); $index->add($document);
} }
@ -102,17 +86,39 @@ class QuestionIndexTask extends Task
} }
/** /**
* 搜索文章 * 刷新索引缓存
* *
* @param string $query * @command: php console.php question_index flush_index
* @return array
* @throws \XSException
*/ */
protected function searchQuestions($query) public function flushIndexAction()
{ {
$handler = new QuestionSearcher(); $handler = new QuestionSearcher();
return $handler->search($query); $index = $handler->getXS()->getIndex();
echo '------ start flush question index ------' . PHP_EOL;
$index->flushIndex();
echo '------ end flush question index ------' . PHP_EOL;
}
/**
* 刷新搜索日志
*
* @command: php console.php question_index flush_logging
*/
public function flushLoggingAction()
{
$handler = new QuestionSearcher();
$index = $handler->getXS()->getIndex();
echo '------ start flush question logging ------' . PHP_EOL;
$index->flushLogging();
echo '------ end flush question logging ------' . PHP_EOL;
} }
/** /**

View File

@ -4,13 +4,13 @@
<div class="vip-header">会员权益</div> <div class="vip-header">会员权益</div>
<div class="vip-reason-list wrap"> <div class="vip-priv-list wrap">
<span class="layui-badge reason-badge">好课畅学</span> <button class="layui-btn layui-bg-blue">好课畅学</button>
<span class="layui-badge reason-badge">会员折扣</span> <button class="layui-btn layui-bg-blue">会员折扣</button>
<span class="layui-badge reason-badge">高清视频</span> <button class="layui-btn layui-bg-blue">高清视频</button>
<span class="layui-badge reason-badge">广告免疫</span> <button class="layui-btn layui-bg-blue">广告免疫</button>
<span class="layui-badge reason-badge">会员标识</span> <button class="layui-btn layui-bg-blue">会员标识</button>
<span class="layui-badge reason-badge">贴心服务</span> <button class="layui-btn layui-bg-blue">优先服务</button>
</div> </div>
<div class="vip-header">开通会员</div> <div class="vip-header">开通会员</div>
@ -57,4 +57,4 @@
{{ js_include('home/js/vip.index.js') }} {{ js_include('home/js/vip.index.js') }}
{% endblock %} {% endblock %}

View File

@ -1292,6 +1292,14 @@
margin-right: 10px; margin-right: 10px;
} }
.sidebar-course-card .meta .price {
color: red;
}
.sidebar-course-card .meta .free {
color: green;
}
.sidebar-chapter-list { .sidebar-chapter-list {
height: 405px; height: 405px;
overflow-y: auto; overflow-y: auto;
@ -1457,20 +1465,12 @@
margin-bottom: 30px; margin-bottom: 30px;
} }
.vip-reason-list { .vip-priv-list {
padding: 30px; padding: 30px;
margin-bottom: 30px; margin-bottom: 30px;
text-align: center; text-align: center;
} }
.vip-reason-list .reason-badge {
height: 30px;
line-height: 30px;
padding: 0 10px;
margin-right: 15px;
background-color: #1E9FFF;
}
.vip-option-list { .vip-option-list {
margin-bottom: 30px; margin-bottom: 30px;
} }
@ -1925,7 +1925,7 @@
.my-profile-card .vip { .my-profile-card .vip {
position: absolute; position: absolute;
right: 15px; right: 15px;
top:15px; top: 15px;
} }
.my-profile-card .avatar { .my-profile-card .avatar {