From 387cf4bcf40eef38746574534ec494b43668df61 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 17 Dec 2019 14:02:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=BC=80=E5=8F=91=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E8=AF=84=E8=AE=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/controllers/CommentController.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/backend/modules/shop/controllers/CommentController.php b/backend/modules/shop/controllers/CommentController.php index c167fa0..01ab832 100644 --- a/backend/modules/shop/controllers/CommentController.php +++ b/backend/modules/shop/controllers/CommentController.php @@ -9,6 +9,7 @@ use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use iron\widget\Excel; +use yii\web\Response; /** * CommentController implements the CRUD actions for Comment model. @@ -147,4 +148,32 @@ class CommentController extends Controller 'columns' => $searchModel->columns() ]); } + + /** + * 显示评论 + * @param $id + * @return Response + * @throws NotFoundHttpException + */ + public function actionDisplay($id) + { + $model = $this->findModel($id); + $model->status = Comment::STATUS_DISPLAY; + $model->save(); + return $this->redirect(['index']); + } + + /** + * 隐藏评论 + * @param $id + * @return Response + * @throws NotFoundHttpException + */ + public function actionHide($id) + { + $model = $this->findModel($id); + $model->status = Comment::STATUS_HIDE; + $model->save(); + return $this->redirect(['index']); + } }