mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
优化用户课程查找
This commit is contained in:
parent
5985576065
commit
ce2329a71c
@ -20,11 +20,13 @@ class StudentController extends Controller
|
||||
*/
|
||||
public function searchAction()
|
||||
{
|
||||
$courseId = $this->request->getQuery('course_id', 'int', 0);
|
||||
|
||||
$studentService = new StudentService();
|
||||
|
||||
$sourceTypes = $studentService->getSourceTypes();
|
||||
|
||||
$xmCourses = $studentService->getXmCourses('all');
|
||||
$xmCourses = $studentService->getXmCourses('all', $courseId);
|
||||
|
||||
$this->view->setVar('source_types', $sourceTypes);
|
||||
$this->view->setVar('xm_courses', $xmCourses);
|
||||
@ -56,9 +58,11 @@ class StudentController extends Controller
|
||||
*/
|
||||
public function addAction()
|
||||
{
|
||||
$courseId = $this->request->getQuery('course_id', 'int', 0);
|
||||
|
||||
$studentService = new StudentService();
|
||||
|
||||
$xmCourses = $studentService->getXmCourses('charge');
|
||||
$xmCourses = $studentService->getXmCourses('all', $courseId);
|
||||
|
||||
$this->view->setVar('xm_courses', $xmCourses);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use App\Validators\CourseUser as CourseUserValidator;
|
||||
class Student extends Service
|
||||
{
|
||||
|
||||
public function getXmCourses($scope = 'all')
|
||||
public function getXmCourses($scope = 'all', $courseId = 0)
|
||||
{
|
||||
$courseRepo = new CourseRepo();
|
||||
|
||||
@ -46,6 +46,7 @@ class Student extends Service
|
||||
$result[] = [
|
||||
'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $item->market_price),
|
||||
'value' => $item->id,
|
||||
'selected' => $item->id == $courseId,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,13 @@
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% set add_url = url({'for':'admin.student.add'}) %}
|
||||
{% set search_url = url({'for':'admin.student.search'}) %}
|
||||
{% if course %}
|
||||
{% set add_url = url({'for':'admin.student.add'},{'course_id':course.id}) %}
|
||||
{% set search_url = url({'for':'admin.student.search'},{'course_id':course.id}) %}
|
||||
{% else %}
|
||||
{% set add_url = url({'for':'admin.student.add'}) %}
|
||||
{% set search_url = url({'for':'admin.student.search'}) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="kg-nav">
|
||||
<div class="kg-nav-left">
|
||||
|
Loading…
x
Reference in New Issue
Block a user