1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-21 03:17:05 +08:00
course-tencent-cloud/app/Http/Home/Controllers/TeacherController.php

70 lines
1.6 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Http\Home\Controllers;
use App\Http\Home\Services\FullH5Url as FullH5UrlService;
use App\Services\Logic\Teacher\TeacherList as TeacherListService;
use Phalcon\Mvc\View;
/**
* @RoutePrefix("/teacher")
*/
class TeacherController extends Controller
{
/**
* @Get("/list", name="home.teacher.list")
*/
public function listAction()
{
$service = new FullH5UrlService();
if ($service->isMobileBrowser() && $service->h5Enabled()) {
$location = $service->getTeacherListUrl();
return $this->response->redirect($location);
}
$this->seo->prependTitle('教师');
}
/**
* @Get("/pager", name="home.teacher.pager")
*/
public function pagerAction()
{
$service = new TeacherListService();
$pager = $service->handle();
$pager->target = 'teacher-list';
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
$this->view->setVar('pager', $pager);
}
/**
* @Get("/{id:[0-9]+}", name="home.teacher.show")
*/
public function showAction($id)
{
$service = new FullH5UrlService();
if ($service->isMobileBrowser() && $service->h5Enabled()) {
$location = $service->getTeacherIndexUrl($id);
return $this->response->redirect($location);
}
$this->dispatcher->forward([
'controller' => 'user',
'action' => 'show',
'params' => ['id' => $id],
]);
}
}