ActionLogController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace backend\modules\common\controllers;
  3. use Yii;
  4. use common\models\base\SearchModel;
  5. use common\enums\StatusEnum;
  6. use common\models\common\ActionLog;
  7. use backend\controllers\BaseController;
  8. /**
  9. * Class ActionLogController
  10. * @package backend\modules\common\controllers
  11. */
  12. class ActionLogController extends BaseController
  13. {
  14. /**
  15. * @return string
  16. * @throws \yii\web\NotFoundHttpException
  17. */
  18. public function actionIndex()
  19. {
  20. $searchModel = new SearchModel([
  21. 'model' => ActionLog::class,
  22. 'scenario' => 'default',
  23. 'partialMatchAttributes' => ['behavior', 'method', 'url', 'remark'], // 模糊查询
  24. 'defaultOrder' => [
  25. 'id' => SORT_DESC,
  26. ],
  27. 'pageSize' => $this->pageSize,
  28. ]);
  29. $dataProvider = $searchModel
  30. ->search(Yii::$app->request->queryParams);
  31. $dataProvider->query
  32. ->andWhere(['is_addon' => StatusEnum::DISABLED])
  33. ->andWhere(['>=', 'status', StatusEnum::DISABLED])
  34. ->with(['member']);
  35. return $this->render($this->action->id, [
  36. 'dataProvider' => $dataProvider,
  37. 'searchModel' => $searchModel,
  38. ]);
  39. }
  40. /**
  41. * 行为日志详情
  42. *
  43. * @param $id
  44. * @return string
  45. */
  46. public function actionView($id)
  47. {
  48. return $this->renderAjax($this->action->id, [
  49. 'model' => ActionLog::findOne($id),
  50. ]);
  51. }
  52. }
粤ICP备19079148号