diff --git a/controllers/AdminController.php b/controllers/AdminController.php index 3e8d5b5..713c495 100644 --- a/controllers/AdminController.php +++ b/controllers/AdminController.php @@ -2,6 +2,7 @@ namespace app\controllers; +use app\models\CollectionUploadedSearch; use app\models\DownloadLogs; use app\models\LoginLogs; use app\models\SiteConfig; @@ -35,7 +36,7 @@ class AdminController extends Controller 'rules' => [ [ 'allow' => true, - 'actions' => ['index', 'system', 'user', 'info', 'user-view', 'user-create', 'user-update', 'user-delete', 'user-totpoff', 'user-pwdreset', 'login-log','access-log'], + 'actions' => ['index', 'system', 'user', 'info', 'user-view', 'user-create', 'user-update', 'user-delete', 'user-totpoff', 'user-pwdreset', 'login-log', 'access-log', 'collection-up-log'], 'roles' => ['admin'], // only admin can do these ] ], @@ -55,6 +56,7 @@ class AdminController extends Controller 'user-pwdreset' => ['POST'], 'login-log' => ['GET'], 'access-log' => ['GET'], + 'collection-up-log' => ['GET'], ], ], ] @@ -409,4 +411,17 @@ class AdminController extends Controller 'dataProvider' => $dataProvider, ]); } + + /** + * @return string + */ + public function actionCollectionUpLog(): string + { + $collectionUploadedSearch = new CollectionUploadedSearch(); + $dataProvider = $collectionUploadedSearch->search($this->request->queryParams); + return $this->render('collection_up_log', [ + 'searchModel' => $collectionUploadedSearch, + 'dataProvider' => $dataProvider, + ]); + } } diff --git a/views/admin/collection_up_log.php b/views/admin/collection_up_log.php new file mode 100644 index 0000000..f9633bb --- /dev/null +++ b/views/admin/collection_up_log.php @@ -0,0 +1,64 @@ +title = '文件收集上传日志'; +?> +
+

title) ?>

+
+ + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'user_id', + 'label' => '用户', + 'format' => 'html', + 'value' => function ($model) { + return nl2br($model->user_id ? $model->user->username . "\n(ID:" . $model->user_id . ')' : '访客'); + }, + ], + [ + 'attribute' => 'uploaded_at', + 'label' => '上传时间', + 'format' => 'html', + 'enableSorting' => false, + 'value' => function ($model) { + return nl2br($model->uploaded_at . "\n(" . Yii::$app->formatter->asRelativeTime(new DateTime($model->uploaded_at, new DateTimeZone('GMT+8'))) . ")"); + }, + ], + [ + 'attribute' => 'task_id', + ], + [ + 'attribute' => 'uploader_ip', + 'label' => 'IP地址', + 'format' => 'raw', + 'value' => function ($model) { + return Html::a($model->uploader_ip, 'https://ipinfo.io/' . $model->uploader_ip, ['target' => '_blank']); + }, + ], + + [ + 'attribute' => 'user_agent', + 'label' => 'User Agent', + ], + ], + 'pager' => [ + 'class' => LinkPager::class, + ], + ]); + + ?> + + + +
\ No newline at end of file diff --git a/views/layouts/admin_main.php b/views/layouts/admin_main.php index 2db137a..4e84544 100644 --- a/views/layouts/admin_main.php +++ b/views/layouts/admin_main.php @@ -76,8 +76,9 @@ $this->registerCssFile('@web/css/fuckyou-navpadding.css'); ['label' => '用户管理', 'url' => ['/admin/user']], ['label' => '个人设置', 'url' => ['/admin/info']], ['label' => '日志管理', 'items' => [ - ['label' => '用户登录', 'url' => ['/admin/login-log']], - ['label' => '分享访问', 'url' => ['/admin/access-log']] + ['label' => '用户登录日志', 'url' => ['/admin/login-log']], + ['label' => '分享访问日志', 'url' => ['/admin/access-log']], + ['label' => '文件收集上传日志', 'url' => ['/admin/collection-up-log']], ], ], ['label' => '系统设置', 'url' => ['/admin/system']],