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, ]; }