Files
ctms-yii/ctms-admin/views/log/login.php
T
2025-07-13 19:37:38 +08:00

136 lines
4.7 KiB
PHP
Executable File

<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use yii\widgets\LinkPager;
$this->title = '登陆日志';
?>
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-primary pull-right">历史</span>
<h5>访客</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins"><?=\backend\components\Helper::getHistoryVisNum()?></h1>
<small>访客</small>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-danger pull-right">最近一个月</span>
<h5>活跃用户</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins"><?=\backend\components\Helper::getMonthHistoryVisNum()?></h1>
<small><?= date('m')?>月</small>
</div>
</div>
</div>
<div class="col-sm-12">
<div id="history"></div>
</div>
</div>
<?php if(\Yii::$app->user->can('/log/login')):?> <!--判断是否有权限,有则显示,无则隐藏-->
<div class="row">
<div class="col-md-12">
<div class="ibox-content">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>用户名</th>
<th>登录IP</th>
<th>登录时间</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<?php foreach($log as $vo):?>
<tr>
<td><?=$vo['id']?></td>
<td><?=$vo['username']?></td>
<td><?=$vo['ip']?></td>
<td><?= date('Y-m-d H:i:s',$vo['create_time'])?></td>
<td><?=str_replace('-','',$vo['data'])?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!--分页-->
<div class="f-r">
<?= LinkPager::widget([
'pagination'=>$pages,
'firstPageLabel' => '首页',
'nextPageLabel' => '下一页',
'prevPageLabel' => '上一页',
'lastPageLabel' => '末页',
]) ?>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
</div>
<?=Html::jsFile('@web/js/plugins/Highcharts/4.1.7/js/highcharts.js')?>
<?=Html::jsFile('@web/js/plugins/Highcharts/4.1.7/js/modules/exporting.js')?>
<script type="text/javascript">
$(function () {
$('#history').highcharts({
title: {
text: '',
x: -20 //center
},
credits: { enabled:false }, //屏蔽右下角
exporting: { enabled:false }, //屏蔽右上角
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: [<?=$HistoryMonthStr?>]
},
yAxis: {
title: {
text: '访客/人'
},
//min: 7.5, // 这个用来控制y轴的开始刻度(最小刻度),另外还有一个表示最大刻度的max属性
startOnTick: false, // y轴坐标是否从某一刻度开始(这个设定与标题无关)
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '人',
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y:,.0f} 人</b><br/>',
shared: true
},
/*legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},*/
series: [{
name: '访客数',
data: [<?=$HistoryMonthNum?>]
}]
});
});
</script>