Browse Source

feat:开发显示隐藏评论接口

antshop
linyaostalker 5 years ago
parent
commit
387cf4bcf4
  1. 29
      backend/modules/shop/controllers/CommentController.php

29
backend/modules/shop/controllers/CommentController.php

@ -9,6 +9,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use iron\widget\Excel; use iron\widget\Excel;
use yii\web\Response;
/** /**
* CommentController implements the CRUD actions for Comment model. * CommentController implements the CRUD actions for Comment model.
@ -147,4 +148,32 @@ class CommentController extends Controller
'columns' => $searchModel->columns() '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']);
}
} }
Loading…
Cancel
Save