From fba681a4b59f546bc6cb40024df4d162d08cf56e Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 16 May 2024 16:46:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4consult=E4=B8=AD=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84chapter=5Fid=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Builders/ConsultList.php | 18 ------------------ app/Http/Home/Views/consult/reply.volt | 16 ++++------------ app/Models/Consult.php | 7 ------- .../Logic/User/Console/ConsultList.php | 3 --- 4 files changed, 4 insertions(+), 40 deletions(-) diff --git a/app/Builders/ConsultList.php b/app/Builders/ConsultList.php index a06e667c..6427f979 100644 --- a/app/Builders/ConsultList.php +++ b/app/Builders/ConsultList.php @@ -7,7 +7,6 @@ namespace App\Builders; -use App\Repos\Chapter as ChapterRepo; use App\Repos\Course as CourseRepo; use App\Repos\User as UserRepo; @@ -54,23 +53,6 @@ class ConsultList extends Builder return $result; } - public function getChapters(array $consults) - { - $ids = kg_array_column($consults, 'chapter_id'); - - $chapterRepo = new ChapterRepo(); - - $chapters = $chapterRepo->findByIds($ids, ['id', 'title']); - - $result = []; - - foreach ($chapters->toArray() as $chapter) { - $result[$chapter['id']] = $chapter; - } - - return $result; - } - public function getUsers(array $consults) { $ownerIds = kg_array_column($consults, 'owner_id'); diff --git a/app/Http/Home/Views/consult/reply.volt b/app/Http/Home/Views/consult/reply.volt index f2b67c07..5097598d 100644 --- a/app/Http/Home/Views/consult/reply.volt +++ b/app/Http/Home/Views/consult/reply.volt @@ -5,18 +5,10 @@ {% set update_url = url({'for':'home.consult.reply','id':consult.id}) %}
- {% if consult.course.id is defined %} -
- -
{{ consult.course.title }}
-
- {% endif %} - {% if consult.chapter.id is defined %} -
- -
{{ consult.chapter.title }}
-
- {% endif %} +
+ +
{{ consult.course.title }}
+
{{ consult.question }}
diff --git a/app/Models/Consult.php b/app/Models/Consult.php index 094ebf32..235697c1 100644 --- a/app/Models/Consult.php +++ b/app/Models/Consult.php @@ -40,13 +40,6 @@ class Consult extends Model */ public $course_id = 0; - /** - * 章节编号 - * - * @var int - */ - public $chapter_id = 0; - /** * 提主编号 * diff --git a/app/Services/Logic/User/Console/ConsultList.php b/app/Services/Logic/User/Console/ConsultList.php index 09ff2ad0..d9e5b19b 100644 --- a/app/Services/Logic/User/Console/ConsultList.php +++ b/app/Services/Logic/User/Console/ConsultList.php @@ -48,14 +48,12 @@ class ConsultList extends LogicService $consults = $pager->items->toArray(); $courses = $builder->getCourses($consults); - $chapters = $builder->getChapters($consults); $items = []; foreach ($consults as $consult) { $course = $courses[$consult['course_id']] ?? new \stdClass(); - $chapter = $chapters[$consult['chapter_id']] ?? new \stdClass(); $items[] = [ 'id' => $consult['id'], @@ -66,7 +64,6 @@ class ConsultList extends LogicService 'reply_time' => $consult['reply_time'], 'create_time' => $consult['create_time'], 'course' => $course, - 'chapter' => $chapter, ]; }