Browse Source

v1.21 add 按时间筛选

pull/16/head
xiaoz 6 years ago
parent
commit
0f8a9df6aa
  1. 8
      admin/index.php
  2. 39
      admin/senioradmin.php
  3. 20
      functions/class/class.admin.php
  4. 2
      functions/version.txt
  5. 17
      static/embed.js
  6. 15
      tpl/admin/footer.php

8
admin/index.php

@ -16,14 +16,17 @@
<!-- 后台内容部分 --> <!-- 后台内容部分 -->
<div class="layui-col-lg9"> <div class="layui-col-lg9">
<div> <div>
<h2>数据统计</h2>
<table class="layui-table"> <table class="layui-table">
<colgroup> <colgroup>
<col width="33%"> <col width="25%">
<col width="33%"> <col width="25%">
<col width="25%">
<col> <col>
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th>累积上传</th>
<th>本月上传数量</th> <th>本月上传数量</th>
<th>今日上传</th> <th>今日上传</th>
<th>可疑图片</th> <th>可疑图片</th>
@ -31,6 +34,7 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><?php echo $data['all']; ?></td>
<td><?php echo $data['month']; ?></td> <td><?php echo $data['month']; ?></td>
<td><?php echo $data['day']; ?></td> <td><?php echo $data['day']; ?></td>
<td><?php echo $data['level']; ?></td> <td><?php echo $data['level']; ?></td>

39
admin/senioradmin.php

@ -8,14 +8,32 @@
$type = $_GET['type']; $type = $_GET['type'];
//获取页数 //获取页数
$page = $_GET['page']; $page = $_GET['page'];
//获取时间
@$date = $_GET['date'];
//如果时间不为空
if($date != ''){
$thedate = explode("|",$date);
$starttime = $thedate[0];
$endtime = $thedate[1];
//翻页选项
$thepage = '&date='.$date;
}
else{
$starttime = '';
//获取当前日期
$endtime = date("Y-m-d",time());
//翻页选项
$thepage = '';
}
//查询图片 //查询图片
$imgs = $pic->querypic($type,$page); $imgs = $pic->querypic($type,$page,$date);
$up = (int)$page - 1; $up = (int)$page - 1;
if($up <= 0){ if($up <= 0){
$up = 1; $up = 1;
} }
$down = (int)$page +1; $down = (int)$page +1;
?> ?>
<div class="layui-container" style = "margin-top:2em;"> <div class="layui-container" style = "margin-top:2em;">
@ -27,6 +45,21 @@
<!-- 后台内容部分 --> <!-- 后台内容部分 -->
<div id = "adminpic"> <div id = "adminpic">
<div class="layui-col-lg9"> <div class="layui-col-lg9">
<!--时间筛选-->
<div id="date">
<table class="layui-table" lay-skin="nob">
<tbody>
<tr>
<td>按时间筛选:</td>
<td><input type="text" class="layui-input" id="starttime" value = "<?php echo $starttime; ?>"></td>
<td> - </td>
<td><input type="text" class="layui-input" id="endtime" value = "<?php echo $endtime; ?>"></td>
<td><button lay-submit class="layui-btn" onclick = "screen()">筛选</button></td>
</tr>
</tbody>
</table>
</div>
<!--时间筛选END-->
<!-- 表格 --> <!-- 表格 -->
<table class="layui-table"> <table class="layui-table">
<colgroup> <colgroup>
@ -100,8 +133,8 @@
<!-- 翻页按钮 --> <!-- 翻页按钮 -->
<div class="layui-col-lg9 layui-col-md-offset3"> <div class="layui-col-lg9 layui-col-md-offset3">
<div class="page"> <div class="page">
<a href="?type=<?php echo $type; ?>&page=<?php echo $up; ?>" class="layui-btn">上一页</a> <a href="?type=<?php echo $type; ?>&page=<?php echo $up.$thepage; ?>" class="layui-btn">上一页</a>
<a href="?type=<?php echo $type; ?>&page=<?php echo $down; ?>" class="layui-btn">下一页</a> <a href="?type=<?php echo $type; ?>&page=<?php echo $down.$thepage; ?>" class="layui-btn">下一页</a>
</div> </div>
</div> </div>
<!-- 翻页按钮END --> <!-- 翻页按钮END -->

20
functions/class/class.admin.php

@ -25,7 +25,15 @@
} }
} }
//查询图片 //查询图片
function querypic($type,$page){ function querypic($type,$page,$date = null){
//对时间进行拆分
if($date != null){
$date = explode("|",$date);
$starttime = $date[0];
$endttime = $date[1];
}
$config = $this->config; $config = $this->config;
$database = $this->database; $database = $this->database;
@ -78,7 +86,10 @@
return $datas; return $datas;
break; break;
default: default:
echo 'dsddsd'; $sql = "SELECT * FROM imginfo WHERE date(date) BETWEEN '$starttime' AND '$endttime' ORDER BY `id` DESC LIMIT $num OFFSET $start";
$datas = $database->query($sql);
return $datas;
break; break;
} }
} }
@ -125,12 +136,15 @@
$level = $this->database->count("imginfo",[ $level = $this->database->count("imginfo",[
"level" => 3 "level" => 3
]); ]);
//统计全部图片
$all = $this->database->count("imginfo");
//返回数据 //返回数据
$redata = array( $redata = array(
"month" => $month, "month" => $month,
"day" => $day, "day" => $day,
"level" => $level "level" => $level,
"all" => $all
); );
return $redata; return $redata;
} }

2
functions/version.txt

@ -1 +1 @@
v1.20(20180811) v1.21(20180831)

17
static/embed.js

@ -451,4 +451,21 @@ function urlup(){
layer.msg(re.msg); layer.msg(re.msg);
} }
}); });
}
//时间筛选
function screen(){
var starttime = $("#starttime").val();
var endtime = $("#endtime").val();
if((starttime == '') || (endtime == '')){
layui.use('layer', function(){
var layer = layui.layer;
layer.msg('请选择时间!');
});
}
else{
window.location.href = "./senioradmin.php?page=1&date=" + starttime + '|' + endtime;
}
} }

15
tpl/admin/footer.php

@ -13,6 +13,19 @@
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../static/layui/layui.js"></script> <script src="../static/layui/layui.js"></script>
<script src="../static/embed.js?v=1.21"></script> <script src="../static/embed.js?v=1.22"></script>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#starttime' //指定元素
});
laydate.render({
elem: '#endtime' //指定元素
});
});
</script>
</body> </body>
</html> </html>
Loading…
Cancel
Save