From b4d6efac5c7b55f20cf4f4c1f4c6c2992d361d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=80=E6=89=8D?= Date: Fri, 1 Mar 2024 14:57:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E6=8E=A5=E5=8F=A3=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wap/controller/Special.php | 27 ++++++++++++++++++----- application/wap/model/special/Special.php | 8 +++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/application/wap/controller/Special.php b/application/wap/controller/Special.php index 62d501b4..1804deb2 100755 --- a/application/wap/controller/Special.php +++ b/application/wap/controller/Special.php @@ -1829,7 +1829,7 @@ class Special extends AuthController } /** - * NEW 课堂首页 + * NEW 梦想课堂 */ public function grade_index() { @@ -1839,8 +1839,7 @@ class Special extends AuthController $offlineCourse = (new \app\wap\model\special\OfflineCourse)->order('id desc')->limit(4)->select(); $uid = $this->uid; - $is_member = isset($this->userInfo['level']) ? $this->userInfo['level'] : 0; - $hot = SpecialModel::getSpecialList(['grade_id' => 0, 'subject_id' => 0, 'search' => '', 'page' => 1, 'limit' => 4, 'type' => 0, 'uid' => $uid, 'is_member' => $is_member, 'is_hot' => 1]); + $hot = SpecialModel::getSpecialList(['grade_id' => 0, 'subject_id' => 0, 'search' => '', 'page' => 1, 'limit' => 4, 'type' => 0, 'uid' => $uid, 'is_hot' => 1]); return JsonService::successful('ok', [ 'banner' => GroupDataService::getData('mxtk_banner') ?: [], @@ -1851,6 +1850,23 @@ class Special extends AuthController ]); } + /** + * NEW 专题首页 + */ + public function special_index($grade_id = 0, $subject_id = 0) + { + $offlineCourse = (new \app\wap\model\special\OfflineCourse)->where(['subject_id' => $subject_id])->order('id desc')->limit(4)->select(); + $hot = SpecialModel::getSpecialList(['grade_id' => $grade_id, 'subject_id' => $subject_id, 'page' => 1, 'limit' => 4, 'type' => 0, 'is_hot' => 1, 'is_member' => 0, 'search' => '']); + + $video = SpecialModel::getSpecialList(['grade_id' => $grade_id, 'subject_id' => $subject_id, 'page' => 1, 'limit' => 4, 'type' => 3, 'special_type' => 3, 'is_member' => 0, 'search' => '', 'uid'=>0]); + return JsonService::successful('ok', [ + 'video_list' => $video, + 'hot_course' => $hot, + 'offline_courses' => $offlineCourse, + ]); + } + + /** * 线下课详情 * @param $id @@ -1908,12 +1924,13 @@ class Special extends AuthController * @param int $page * @param int $limit * @param int $type 学习记录获取专题使用 + * @param int $special_type 专题类型 */ - public function get_special_list($grade_id = 0, $subject_id = 0, $search = '', $page = 1, $limit = 10, $type = 0) + public function get_special_list($grade_id = 0, $subject_id = 0, $search = '', $page = 1, $limit = 10, $type = 0, $special_type = '') { $uid = $this->uid; $is_member = isset($this->userInfo['level']) ? $this->userInfo['level'] : 0; - return JsonService::successful(SpecialModel::getSpecialList(compact('grade_id', 'subject_id', 'search', 'page', 'limit', 'type', 'uid', 'is_member'))); + return JsonService::successful(SpecialModel::getSpecialList(compact('grade_id', 'subject_id', 'search', 'page', 'limit', 'type', 'uid', 'is_member', 'special_type'))); } /** diff --git a/application/wap/model/special/Special.php b/application/wap/model/special/Special.php index 74720cd1..86a90b0f 100755 --- a/application/wap/model/special/Special.php +++ b/application/wap/model/special/Special.php @@ -339,11 +339,16 @@ class Special extends ModelBasic */ public static function setWhere($where) { + // 专题类型 + $specialType = isset($where['special_type']) ? $where['special_type'] : ''; if ($where['type']) { $model = self::PreWhere('a'); if ($where['subject_id'] && $where['grade_id']) { $model = $model->where('a.subject_id', $where['subject_id']); } + if($specialType){ + $model = $model->where('a.type', $specialType); + } if ($where['search']) { $model = $model->where('a.title', 'LIKE', "%$where[search]%"); } @@ -353,6 +358,9 @@ class Special extends ModelBasic ->group('a.id')->where('uid', $where['uid']); } else { $model = self::PreWhere(); + if($specialType){ + $model = $model->where('type', $specialType); + } if ($where['subject_id'] && $where['grade_id'] > 0) { $model = $model->where('subject_id', $where['subject_id']); } else if ($where['subject_id'] == 0 && $where['grade_id'] > 0) {