index.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. /* @var $this yii\web\View */
  5. /* @var $dataProvider yii\data\ActiveDataProvider */
  6. $this->title = '操作日志';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <div class="admin-log-index">
  10. <div class="box box-success">
  11. <div class="box-body">
  12. <?= GridView::widget([
  13. 'dataProvider' => $dataProvider,
  14. 'columns' => [
  15. 'id',
  16. 'route',
  17. [
  18. 'attribute' => 'user_id',
  19. 'format' => 'raw',
  20. 'value' => function ($model) {
  21. /* @var \common\models\AdminLog $model */
  22. if ($model->user) {
  23. return Html::a($model->user->nickname, \yii\helpers\Url::to(['/user/default/update', 'id' => $model->user_id]), ['title' => '查看用户', 'data-toggle' => 'tooltip', 'target' => '_blank']);
  24. }
  25. return '';
  26. }
  27. ],
  28. [
  29. 'attribute' => 'ip',
  30. 'value' => function ($model) {
  31. return long2ip($model->ip);
  32. }
  33. ],
  34. 'created_at:datetime',
  35. [
  36. 'class' => 'common\helpers\DiyActionColumn',
  37. 'template' => '{view}'
  38. ],
  39. ],
  40. ]); ?>
  41. </div>
  42. </div>
  43. </div>