Commit 028f7a8a authored by xiabin's avatar xiabin

add 404

parent 066dc72f
......@@ -21,6 +21,7 @@ use yii\filters\AccessControl;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\web\ForbiddenHttpException;
use yii\web\HttpException;
class HomeController extends \yii\web\Controller
{
......@@ -60,6 +61,7 @@ class HomeController extends \yii\web\Controller
* 首页
* @param $classId 课堂id
* @return string
* @throws HttpException
*/
public function actionIndex($classId)
{
......@@ -71,7 +73,7 @@ class HomeController extends \yii\web\Controller
'classInfo' => $classInfo
]);
} else {
throw new InvalidParamException('参数错误');
throw new HttpException(404,'页面不存在');
}
}
......@@ -82,7 +84,7 @@ class HomeController extends \yii\web\Controller
* @param $classId
* @param $page
* @param int $num
* @throws ForbiddenHttpException
* @throws HttpException
*/
public function actionGetCourseLists($classId, $page, $num = 10)
{
......@@ -90,7 +92,7 @@ class HomeController extends \yii\web\Controller
if ($page >= 0 and $num > 0) {
$result = Course::getCourseListsByClassId($classId, $page, $num);
} else {
throw new InvalidParamException('参数错误');
throw new HttpException(404,'页面不存在');
}
} else {
throw new ForbiddenHttpException('非法请求');
......
......@@ -43,7 +43,6 @@ $qiniu = \Yii::$app->qiniu;
target="_blank"><?= $course['name'] ?></a></div>
<?php endif; ?>
<div class="teacher">
<?php if ($course['teachers']) { ?>讲师:<?= join(', ', array_column($course['teachers'], 'name')) ?><?php } ?>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment