1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-08-01 20:39:06 +08:00

修复记录为空分页问题

This commit is contained in:
koogua 2021-06-19 18:07:20 +08:00
parent 10e99c818e
commit 7c4b6fff82

View File

@ -30,10 +30,12 @@ class ConsultList extends LogicService
$page = $pagerQuery->getPage();
$limit = $pagerQuery->getLimit();
$params['course_id'] = 0;
$courses = $this->findTeachingCourses($user->id);
if ($courses->count() == 0) {
return [];
if ($courses->count() > 0) {
$params['course_id'] = kg_array_column($courses->toArray(), 'id');
}
$params['status'] = $params['status'] ?? null;
@ -44,8 +46,6 @@ class ConsultList extends LogicService
$params['replied'] = 1;
}
$params['course_id'] = kg_array_column($courses->toArray(), 'id');
$pager = $this->paginate($params, $page, $limit);
return $this->handleConsults($pager);