From 80527f8035fb8e0a6b954f6f022a549d38ee422a Mon Sep 17 00:00:00 2001 From: zm <zm@iemsoft.cn> Date: Fri, 11 Sep 2020 14:19:51 +0800 Subject: [PATCH] 按知识点搜索(未完) --- we254/addons/fy_lessonv2/inc/mobile/search.php | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/we254/addons/fy_lessonv2/inc/mobile/search.php b/we254/addons/fy_lessonv2/inc/mobile/search.php index 4cf2167..6594cf0 100644 --- a/we254/addons/fy_lessonv2/inc/mobile/search.php +++ b/we254/addons/fy_lessonv2/inc/mobile/search.php @@ -35,11 +35,11 @@ } /* 知识点分类 */ -$hot_knowledge = pdo_fetchall("SELECT * FROM " . tablename($this -> table_knowledge_point) . " WHERE uniacid=:uniacid AND is_hot=:is_hot AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid' => $uniacid, ':is_hot' => 1,':search_show'=>1)); -$knowledgelist = pdo_fetchall("SELECT * FROM " . tablename($this -> table_knowledge_point) . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>0,':search_show'=>1)); +$hot_knowledge = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND is_hot=:is_hot AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid' => $uniacid, ':is_hot' => 1,':search_show'=>1)); +$knowledgelist = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>0,':search_show'=>1)); foreach ($knowledgelist as $k => $v) { - $knowledgelist[$k]['child'] = pdo_fetchall("SELECT * FROM " . tablename($this -> table_knowledge_point) . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>$v['id'],':search_show'=>1)); + $knowledgelist[$k]['child'] = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>$v['id'],':search_show'=>1)); } if ($op == 'display') { @@ -50,6 +50,7 @@ $sort = trim($_GPC['sort']); $attr1 = $_GPC['attr1']; $attr2 = $_GPC['attr2']; + $know_id = $_GPC['knowledge_id']; $condition = " a.uniacid = '{$uniacid}' AND a.status=1 "; $order = " ORDER BY a.displayorder DESC, a.id DESC "; @@ -65,6 +66,15 @@ $catname = $common['page_title']['search'] ? $common['page_title']['search'] : '全部分类'; } + /* 按知识点搜索 */ + if ($know_id > 0) { + $condition .= " AND (a.knowledge_pid='{$know_id}' OR a.knowledge_id='{$know_id}')"; + $nowknow = pdo_fetch("SELECT name FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid='{$uniacid}' AND id='{$know_id}'"); + $knowledgename = $nowknow['name']; + } else { + $knowledgename = $common['page_title']['search'] ? $common['page_title']['search'] : '知识点'; + } + /* 综合排序 */ if ($sort == 'general') { $condition .= " AND a.lesson_type=0"; @@ -75,6 +85,9 @@ } elseif ($sort == 'live') { $condition .= " AND a.lesson_type=3"; $sortname = '直播课程'; + } elseif ($sort == 'knowledge') { + $condition .= " AND a.lesson_type=5"; + $sortname = '知识点课'; } elseif ($sort == 'price') { $order = " ORDER BY a.price ASC, a.displayorder DESC "; $sortname = '价格优先'; -- Gitblit v1.8.0