diff --git a/app/Builders/CourseList.php b/app/Builders/CourseList.php
index 4cf907c6..43be2cd8 100644
--- a/app/Builders/CourseList.php
+++ b/app/Builders/CourseList.php
@@ -3,111 +3,56 @@
namespace App\Builders;
use App\Caches\CategoryList as CategoryListCache;
-use App\Repos\CourseCategory as CourseCategoryRepo;
use App\Repos\User as UserRepo;
class CourseList extends Builder
{
- public function handleCourses($courses)
- {
- $baseUrl = kg_ci_base_url();
-
- $list = [];
-
- foreach ($courses as $course) {
-
- $course['categories'] = [];
- $course['cover'] = $baseUrl . $course['cover'];
- $course['attrs'] = json_decode($course['attrs'], true);
-
- $result[] = [
- 'id' => $course['id'],
- 'title' => $course['title'],
- 'cover' => $course['cover'],
- 'summary' => $course['summary'],
- 'categories' => $course['categories'],
- 'market_price' => (float)$course['market_price'],
- 'vip_price' => (float)$course['vip_price'],
- 'study_expiry' => $course->study_expiry,
- 'refund_expiry' => $course->refund_expiry,
- 'rating' => (float)$course['rating'],
- 'score' => (float)$course['score'],
- 'model' => $course['model'],
- 'level' => $course['level'],
- 'attrs' => $course['attrs'],
- 'user_count' => $course['user_count'],
- 'lesson_count' => $course['lesson_count'],
- 'comment_count' => $course['comment_count'],
- 'review_count' => $course['review_count'],
- 'favorite_count' => $course['favorite_count'],
- ];
- }
-
- return $list;
- }
-
public function handleCategories($courses)
{
- $categories = $this->getCategories($courses);
+ $categories = $this->getCategories();
foreach ($courses as $key => $course) {
- $courses[$key]['categories'] = $categories[$course['id']] ?? [];
+ $courses[$key]['category'] = $categories[$course['category_id']] ?? [];
}
return $courses;
}
- public function handleUsers($courses)
+ public function handleTeachers($courses)
{
- $users = $this->getUsers($courses);
+ $teachers = $this->getTeachers($courses);
foreach ($courses as $key => $course) {
- $courses[$key]['user'] = $users[$course['user_id']] ?? [];
+ $courses[$key]['teacher'] = $teachers[$course['teacher_id']] ?? [];
}
return $courses;
}
- protected function getCategories($courses)
+ protected function getCategories()
{
- $categoryListCache = new CategoryListCache();
+ $cache = new CategoryListCache();
- $categoryList = $categoryListCache->get();
+ $items = $cache->get();
- if (!$categoryList) {
- return [];
- }
-
- $mapping = [];
-
- foreach ($categoryList as $category) {
- $mapping[$category['id']] = [
- 'id' => $category['id'],
- 'name' => $category['name'],
- ];
- }
-
- $courseIds = kg_array_column($courses, 'id');
-
- $courseCategoryRepo = new CourseCategoryRepo();
-
- $relations = $courseCategoryRepo->findByCourseIds($courseIds);
+ if (!$items) return null;
$result = [];
- foreach ($relations as $relation) {
- $categoryId = $relation->category_id;
- $courseId = $relation->course_id;
- $result[$courseId][] = $mapping[$categoryId] ?? [];
+ foreach ($items as $item) {
+ $result[$item['id']] = [
+ 'id' => $item['id'],
+ 'name' => $item['name'],
+ ];
}
return $result;
}
- protected function getUsers($courses)
+ protected function getTeachers($courses)
{
- $ids = kg_array_column($courses, 'user_id');
+ $ids = kg_array_column($courses, 'teacher_id');
$userRepo = new UserRepo();
diff --git a/app/Caches/CourseRelatedList.php b/app/Caches/CourseRelatedList.php
index 67f80c90..70c797eb 100644
--- a/app/Caches/CourseRelatedList.php
+++ b/app/Caches/CourseRelatedList.php
@@ -47,7 +47,6 @@ class CourseRelatedList extends Cache
'id' => $course->id,
'title' => $course->title,
'cover' => $course->cover,
- 'summary' => $course->summary,
'market_price' => $course->market_price,
'vip_price' => $course->vip_price,
'rating' => $course->rating,
diff --git a/app/Caches/CourseUser.php b/app/Caches/CourseUser.php
deleted file mode 100644
index 433a9425..00000000
--- a/app/Caches/CourseUser.php
+++ /dev/null
@@ -1,39 +0,0 @@
-lifetime;
- }
-
- /**
- * id = {$courseId}_{$userId}
- *
- * @param string $id
- * @return string
- */
- public function getKey($id = null)
- {
- return "course_user:{$id}";
- }
-
- public function getContent($id = null)
- {
- list($courseId, $userId) = explode('_', $id);
-
- $courseUserRepo = new CourseUserRepo();
-
- $courseUser = $courseUserRepo->findCourseUser($courseId, $userId);
-
- return $courseUser ?: null;
- }
-
-}
diff --git a/app/Caches/HotCourseList.php b/app/Caches/HotCourseList.php
deleted file mode 100644
index c488bbb2..00000000
--- a/app/Caches/HotCourseList.php
+++ /dev/null
@@ -1,72 +0,0 @@
-lifetime;
- }
-
- public function getKey($id = null)
- {
- return 'hot_course_list';
- }
-
- public function getContent($id = null)
- {
- $courses = $this->findHotCourses($id);
-
- if ($courses->count() == 0) {
- return [];
- }
-
- return $this->handleContent($courses);
- }
-
- /**
- * @param CourseModel[] $courses
- * @return array
- */
- public function handleContent($courses)
- {
- $result = [];
-
- foreach ($courses as $course) {
- $result[] = [
- 'id' => $course->id,
- 'title' => $course->title,
- 'summary' => $course->summary,
- 'cover' => $course->cover,
- 'market_price' => $course->market_price,
- 'vip_price' => $course->vip_price,
- 'model' => $course->model,
- 'level' => $course->level,
- ];
- }
-
- return $result;
- }
-
- /**
- * @param int $limit
- * @return ResultsetInterface|Resultset|CourseModel[]
- */
- protected function findHotCourses($limit = 10)
- {
- return CourseModel::query()
- ->where('deleted = 0')
- ->orderBy('score DESC')
- ->limit($limit)
- ->execute();
- }
-
-}
diff --git a/app/Caches/IndexFreeCourseList.php b/app/Caches/IndexFreeCourseList.php
new file mode 100644
index 00000000..3ed9377c
--- /dev/null
+++ b/app/Caches/IndexFreeCourseList.php
@@ -0,0 +1,114 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'index_free_course_list';
+ }
+
+ public function getContent($id = null)
+ {
+ $result = [];
+
+ $categoryLimit = 5;
+
+ $courseLimit = 5;
+
+ $categories = $this->findCategories($categoryLimit);
+
+ if ($categories->count() == 0) {
+ return null;
+ }
+
+ foreach ($categories as $category) {
+
+ $categoryItem = [
+ 'id' => $category->id,
+ 'name' => $category->name,
+ ];
+
+ $courses = $this->findCategoryCourses($category->id, $courseLimit);
+
+ if ($courses->count() == 0) continue;
+
+ $categoryCourses = [];
+
+ foreach ($courses as $course) {
+ $categoryCourses[] = [
+ 'id' => $course->id,
+ 'title' => $course->title,
+ 'cover' => $course->cover,
+ 'market_price' => $course->market_price,
+ 'vip_price' => $course->vip_price,
+ 'model' => $course->model,
+ 'level' => $course->level,
+ 'user_count' => $course->user_count,
+ 'lesson_count' => $course->lesson_count,
+ ];
+ }
+
+ $categoryItem['courses'] = $categoryCourses;
+
+ $result[] = $categoryItem;
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CategoryModel[]
+ */
+ protected function findCategories($limit = 5)
+ {
+ return CategoryModel::query()
+ ->andWhere('published = 1')
+ ->orderBy('priority ASC')
+ ->limit($limit)
+ ->execute();
+ }
+
+ /**
+ * @param int $categoryId
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CourseModel[]
+ */
+ protected function findCategoryCourses($categoryId, $limit = 10)
+ {
+ $categoryService = new CategoryService();
+
+ $categoryIds = $categoryService->getChildCategoryIds($categoryId);
+
+ return CourseModel::query()
+ ->inWhere('category_id', $categoryIds)
+ ->andWhere('published = 1')
+ ->andWhere('market_price = 0')
+ ->orderBy('id DESC')
+ ->limit($limit)
+ ->execute();
+ }
+
+}
diff --git a/app/Caches/HotTeacherList.php b/app/Caches/IndexHotTeacherList.php
similarity index 89%
rename from app/Caches/HotTeacherList.php
rename to app/Caches/IndexHotTeacherList.php
index d16c5579..ce412a8f 100644
--- a/app/Caches/HotTeacherList.php
+++ b/app/Caches/IndexHotTeacherList.php
@@ -2,7 +2,7 @@
namespace App\Caches;
-class HotTeacherList extends Cache
+class IndexHotTeacherList extends Cache
{
protected $lifetime = 365 * 86400;
diff --git a/app/Caches/IndexLiveCourseList.php b/app/Caches/IndexLiveCourseList.php
new file mode 100644
index 00000000..0521286f
--- /dev/null
+++ b/app/Caches/IndexLiveCourseList.php
@@ -0,0 +1,141 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'index_live_course_list';
+ }
+
+ public function getContent($id = null)
+ {
+ /**
+ * 限制输出多少天数(一维限额)
+ */
+ $dayLimit = 3;
+
+ /**
+ * 限制每天维度下的输出数(二维限额)
+ */
+ $perDayLimit = 5;
+
+ $beginTime = strtotime('today');
+ $endTime = strtotime("+30 days");
+
+ $result = [];
+
+ /**
+ * @var Resultset|ChapterLiveModel[] $lives
+ */
+ $lives = ChapterLiveModel::query()
+ ->betweenWhere('start_time', $beginTime, $endTime)
+ ->orderBy('start_time ASC')
+ ->execute();
+
+ if ($lives->count() == 0) {
+ return $result;
+ }
+
+ $chapterIds = kg_array_column($lives->toArray(), 'chapter_id');
+
+ $chapterRepo = new ChapterRepo();
+
+ $chapters = $chapterRepo->findByIds($chapterIds);
+
+ $chapterMappings = [];
+
+ foreach ($chapters as $chapter) {
+ $chapterMappings[$chapter->id] = $chapter;
+ }
+
+ $courseIds = kg_array_column($lives->toArray(), 'course_id');
+
+ $courseRepo = new CourseRepo();
+
+ $courses = $courseRepo->findByIds($courseIds);
+
+ $courseMappings = [];
+
+ foreach ($courses as $course) {
+ $courseMappings[$course->id] = $course;
+ }
+
+ $teacherIds = kg_array_column($courses->toArray(), 'teacher_id');
+
+ $userRepo = new UserRepo();
+
+ $teachers = $userRepo->findByIds($teacherIds);
+
+ $teacherMappings = [];
+
+ foreach ($teachers as $teacher) {
+ $teacherMappings[$teacher->id] = $teacher;
+ }
+
+ foreach ($lives as $live) {
+
+ if (count($result) >= $dayLimit) {
+ break;
+ }
+
+ $day = date('y-m-d', $live->start_time);
+
+ if (isset($result[$day]) && count($result[$day]) >= $perDayLimit) {
+ continue;
+ }
+
+ $chapter = $chapterMappings[$live->chapter_id];
+ $course = $courseMappings[$chapter->course_id];
+ $teacher = $teacherMappings[$course->teacher_id];
+
+ $chapterInfo = [
+ 'id' => $chapter->id,
+ 'title' => $chapter->title,
+ ];
+
+ $courseInfo = [
+ 'id' => $course->id,
+ 'title' => $course->title,
+ 'cover' => $course->cover,
+ ];
+
+ $teacherInfo = [
+ 'id' => $teacher->id,
+ 'name' => $teacher->name,
+ 'avatar' => $teacher->avatar,
+ ];
+
+ $result[$day][] = [
+ 'course' => $courseInfo,
+ 'chapter' => $chapterInfo,
+ 'teacher' => $teacherInfo,
+ 'start_time' => $live->start_time,
+ ];
+ }
+
+ return $result;
+ }
+
+}
diff --git a/app/Caches/IndexNewCourseList.php b/app/Caches/IndexNewCourseList.php
new file mode 100644
index 00000000..44a9ade4
--- /dev/null
+++ b/app/Caches/IndexNewCourseList.php
@@ -0,0 +1,113 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'index_new_course_list';
+ }
+
+ public function getContent($id = null)
+ {
+ $result = [];
+
+ $categoryLimit = 5;
+
+ $courseLimit = 5;
+
+ $categories = $this->findCategories($categoryLimit);
+
+ if ($categories->count() == 0) {
+ return null;
+ }
+
+ foreach ($categories as $category) {
+
+ $categoryItem = [
+ 'id' => $category->id,
+ 'name' => $category->name,
+ ];
+
+ $courses = $this->findCategoryCourses($category->id, $courseLimit);
+
+ if ($courses->count() == 0) continue;
+
+ $categoryCourses = [];
+
+ foreach ($courses as $course) {
+ $categoryCourses[] = [
+ 'id' => $course->id,
+ 'title' => $course->title,
+ 'cover' => $course->cover,
+ 'market_price' => $course->market_price,
+ 'vip_price' => $course->vip_price,
+ 'model' => $course->model,
+ 'level' => $course->level,
+ 'user_count' => $course->user_count,
+ 'lesson_count' => $course->lesson_count,
+ ];
+ }
+
+ $categoryItem['courses'] = $categoryCourses;
+
+ $result[] = $categoryItem;
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CategoryModel[]
+ */
+ protected function findCategories($limit = 5)
+ {
+ return CategoryModel::query()
+ ->andWhere('published = 1')
+ ->orderBy('priority ASC')
+ ->limit($limit)
+ ->execute();
+ }
+
+ /**
+ * @param int $categoryId
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CourseModel[]
+ */
+ protected function findCategoryCourses($categoryId, $limit = 10)
+ {
+ $categoryService = new CategoryService();
+
+ $categoryIds = $categoryService->getChildCategoryIds($categoryId);
+
+ return CourseModel::query()
+ ->inWhere('category_id', $categoryIds)
+ ->andWhere('published = 1')
+ ->orderBy('id DESC')
+ ->limit($limit)
+ ->execute();
+ }
+
+}
diff --git a/app/Caches/IndexVipCourseList.php b/app/Caches/IndexVipCourseList.php
new file mode 100644
index 00000000..c1fed8ac
--- /dev/null
+++ b/app/Caches/IndexVipCourseList.php
@@ -0,0 +1,114 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'index_vip_course_list';
+ }
+
+ public function getContent($id = null)
+ {
+ $result = [];
+
+ $categoryLimit = 5;
+
+ $courseLimit = 5;
+
+ $categories = $this->findCategories($categoryLimit);
+
+ if ($categories->count() == 0) {
+ return null;
+ }
+
+ foreach ($categories as $category) {
+
+ $categoryItem = [
+ 'id' => $category->id,
+ 'name' => $category->name,
+ ];
+
+ $courses = $this->findCategoryCourses($category->id, $courseLimit);
+
+ if ($courses->count() == 0) continue;
+
+ $categoryCourses = [];
+
+ foreach ($courses as $course) {
+ $categoryCourses[] = [
+ 'id' => $course->id,
+ 'title' => $course->title,
+ 'cover' => $course->cover,
+ 'market_price' => $course->market_price,
+ 'vip_price' => $course->vip_price,
+ 'model' => $course->model,
+ 'level' => $course->level,
+ 'user_count' => $course->user_count,
+ 'lesson_count' => $course->lesson_count,
+ ];
+ }
+
+ $categoryItem['courses'] = $categoryCourses;
+
+ $result[] = $categoryItem;
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CategoryModel[]
+ */
+ protected function findCategories($limit = 5)
+ {
+ return CategoryModel::query()
+ ->andWhere('published = 1')
+ ->orderBy('priority ASC')
+ ->limit($limit)
+ ->execute();
+ }
+
+ /**
+ * @param int $categoryId
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|CourseModel[]
+ */
+ protected function findCategoryCourses($categoryId, $limit = 10)
+ {
+ $categoryService = new CategoryService();
+
+ $categoryIds = $categoryService->getChildCategoryIds($categoryId);
+
+ return CourseModel::query()
+ ->inWhere('category_id', $categoryIds)
+ ->andWhere('published = 1')
+ ->andWhere('vip_price >= 0')
+ ->orderBy('id DESC')
+ ->limit($limit)
+ ->execute();
+ }
+
+}
diff --git a/app/Caches/LatestCourseList.php b/app/Caches/LatestCourseList.php
deleted file mode 100644
index a110ec3a..00000000
--- a/app/Caches/LatestCourseList.php
+++ /dev/null
@@ -1,77 +0,0 @@
-lifetime;
- }
-
- public function getKey($id = null)
- {
- return 'latest_course_list';
- }
-
- public function getContent($id = null)
- {
- $courses = $this->findLatestCourses(5);
-
- if ($courses->count() == 0) {
- return [];
- }
-
- return $this->handleContent($courses);
- }
-
- /**
- * @param CourseModel[] $courses
- * @return array
- */
- public function handleContent($courses)
- {
- $result = [];
-
- $baseUrl = kg_ci_base_url();
-
- foreach ($courses as $course) {
-
- $course->cover = $baseUrl . $course->cover;
-
- $result[] = [
- 'id' => $course->id,
- 'title' => $course->title,
- 'summary' => $course->summary,
- 'cover' => $course->cover,
- 'market_price' => $course->market_price,
- 'vip_price' => $course->vip_price,
- 'model' => $course->model,
- 'level' => $course->level,
- ];
- }
-
- return $result;
- }
-
- /**
- * @param int $limit
- * @return ResultsetInterface|Resultset|CourseModel[]
- */
- protected function findLatestCourses($limit = 10)
- {
- return CourseModel::query()
- ->where('deleted = 0')
- ->orderBy('create_time DESC')
- ->limit($limit)
- ->execute();
- }
-
-}
diff --git a/app/Caches/PackageCourseList.php b/app/Caches/PackageCourseList.php
index 05860e42..c213c507 100644
--- a/app/Caches/PackageCourseList.php
+++ b/app/Caches/PackageCourseList.php
@@ -46,7 +46,6 @@ class PackageCourseList extends Cache
'id' => $course->id,
'title' => $course->title,
'cover' => $course->cover,
- 'summary' => $course->summary,
'market_price' => $course->market_price,
'vip_price' => $course->vip_price,
'rating' => $course->rating,
diff --git a/app/Caches/TopicCourseList.php b/app/Caches/TopicCourseList.php
index f02ffbbc..2ff4868e 100644
--- a/app/Caches/TopicCourseList.php
+++ b/app/Caches/TopicCourseList.php
@@ -46,7 +46,6 @@ class TopicCourseList extends Cache
'id' => $course->id,
'title' => $course->title,
'cover' => $course->cover,
- 'summary' => $course->summary,
'market_price' => $course->market_price,
'vip_price' => $course->vip_price,
'rating' => $course->rating,
diff --git a/app/Console/Tasks/SyncChapterCounterTask.php b/app/Console/Tasks/SyncChapterCounterTask.php
index cd32fff6..61e79eba 100644
--- a/app/Console/Tasks/SyncChapterCounterTask.php
+++ b/app/Console/Tasks/SyncChapterCounterTask.php
@@ -2,6 +2,7 @@
namespace App\Console\Tasks;
+use App\Caches\Chapter as ChapterCache;
use App\Caches\ChapterCounter as ChapterCounterCache;
use App\Library\Cache\Backend\Redis as RedisCache;
use App\Repos\Chapter as ChapterRepo;
@@ -45,11 +46,13 @@ class SyncChapterCounterTask extends Task
return;
}
- $cache = new ChapterCounterCache();
+ $chapterCache = new ChapterCache();
+
+ $chapterCounterCache = new ChapterCounterCache();
foreach ($chapters as $chapter) {
- $counter = $cache->get($chapter->id);
+ $counter = $chapterCounterCache->get($chapter->id);
if ($counter) {
@@ -60,6 +63,8 @@ class SyncChapterCounterTask extends Task
$chapter->oppose_count = $counter['oppose_count'];
$chapter->update();
+
+ $chapterCache->rebuild($chapter->id);
}
}
diff --git a/app/Console/Tasks/SyncCourseCounterTask.php b/app/Console/Tasks/SyncCourseCounterTask.php
index 4ddc1a5b..9cda6066 100644
--- a/app/Console/Tasks/SyncCourseCounterTask.php
+++ b/app/Console/Tasks/SyncCourseCounterTask.php
@@ -2,6 +2,7 @@
namespace App\Console\Tasks;
+use App\Caches\Course as CourseCache;
use App\Caches\CourseCounter as CourseCounterCache;
use App\Library\Cache\Backend\Redis as RedisCache;
use App\Repos\Course as CourseRepo;
@@ -45,11 +46,13 @@ class SyncCourseCounterTask extends Task
return;
}
- $cache = new CourseCounterCache();
+ $courseCounterCache = new CourseCounterCache();
+
+ $courseCache = new CourseCache();
foreach ($courses as $course) {
- $counter = $cache->get($course->id);
+ $counter = $courseCounterCache->get($course->id);
if ($counter) {
@@ -61,6 +64,8 @@ class SyncCourseCounterTask extends Task
$course->favorite_count = $counter['favorite_count'];
$course->update();
+
+ $courseCache->rebuild($course->id);
}
}
diff --git a/app/Http/Admin/Controllers/CourseController.php b/app/Http/Admin/Controllers/CourseController.php
index 8e0612f9..6818a763 100644
--- a/app/Http/Admin/Controllers/CourseController.php
+++ b/app/Http/Admin/Controllers/CourseController.php
@@ -18,8 +18,10 @@ class CourseController extends Controller
$courseService = new CourseService();
$xmCategories = $courseService->getXmCategories(0);
+ $xmTeachers = $courseService->getXmTeachers(0);
$this->view->setVar('xm_categories', $xmCategories);
+ $this->view->setVar('xm_teachers', $xmTeachers);
}
/**
diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php
index 7598d036..30daec62 100644
--- a/app/Http/Admin/Services/Chapter.php
+++ b/app/Http/Admin/Services/Chapter.php
@@ -44,13 +44,13 @@ class Chapter extends Service
$data['course_id'] = $course->id;
$data['title'] = $validator->checkTitle($post['title']);
$data['summary'] = $validator->checkSummary($post['summary']);
- $data['free'] = $validator->checkFreeStatus($post['free']);
$chapterRepo = new ChapterRepo();
if (isset($post['parent_id'])) {
$parent = $validator->checkParent($post['parent_id']);
$data['parent_id'] = $parent->id;
+ $data['free'] = $validator->checkFreeStatus($post['free']);
$data['priority'] = $chapterRepo->maxLessonPriority($post['parent_id']);
} else {
$data['priority'] = $chapterRepo->maxChapterPriority($post['course_id']);
diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php
index 85f39c6f..11abf1b9 100644
--- a/app/Http/Admin/Services/Course.php
+++ b/app/Http/Admin/Services/Course.php
@@ -36,6 +36,11 @@ class Course extends Service
$params['category_id'] = count($xmCategoryIds) > 1 ? $xmCategoryIds : $xmCategoryIds[0];
}
+ if (!empty($params['xm_teacher_ids'])) {
+ $xmTeacherIds = explode(',', $params['xm_teacher_ids']);
+ $params['teacher_id'] = count($xmTeacherIds) > 1 ? $xmTeacherIds : $xmTeacherIds[0];
+ }
+
$params['deleted'] = $params['deleted'] ?? 0;
$sort = $pagerQuery->getSort();
@@ -516,9 +521,10 @@ class Course extends Service
$pipeA = $pager->items->toArray();
$pipeB = $builder->handleCategories($pipeA);
- $pipeC = $builder->objects($pipeB);
+ $pipeC = $builder->handleTeachers($pipeB);
+ $pipeD = $builder->objects($pipeC);
- $pager->items = $pipeC;
+ $pager->items = $pipeD;
}
return $pager;
diff --git a/app/Http/Admin/Views/course/edit_basic.volt b/app/Http/Admin/Views/course/edit_basic.volt
index 49cbe2de..9bd5fa4f 100644
--- a/app/Http/Admin/Views/course/edit_basic.volt
+++ b/app/Http/Admin/Views/course/edit_basic.volt
@@ -13,7 +13,7 @@
{% if course.cover %}
{% else %}
-
+ {{ image('id':'cover-img','class':'kg-cover','src':'admin/img/default_cover.png') }}
{% endif %}
@@ -49,7 +49,7 @@
标题:{{ item.title }} {{ model_info(item.model) }}
-分类:{{ category_info(item.categories) }}
+{{ category_info(item.category) }} {{ teacher_info(item.teacher) }}