<?php
error_reporting(0); 
include("../../config/ht.php");
session_start();
if(!isset($_SESSION['adminname'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
$adminname=$_SESSION['adminname'];
$type="where name='$adminname'";
$adminpd=queryall(admin,$type);
if(!$adminpd){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
//绘制图表
for($i = 0;$i <24;$i++){
$tmp = 'sj';
$tmp .= $i;
$$tmp = "0";
$sql = sprintf("select sum(money) from dingdan where     shijian>='".date('Y-m-d').' '."%02d:00:00"."' and shijian<='".date('Y-m-d').' '."%02d:59:59"."'",$i,$i);
if ($res=mysql_query($sql)){
list($$tmp)=mysql_fetch_row($res);
$$tmp = empty($$tmp) ? "0" : $$tmp;
mysql_free_result($res);
}
}
for($i = 0;$i <24;$i++){
$tmp = 'dj';
$tmp .= $i;
$$tmp = "0";
$sql = sprintf("select sum(money) from dingdan where    shijian>='".date('Y-m-d',strtotime('-1 day')).' '."%02d:00:00"."' and shijian<='".date('Y-m-d',strtotime('-1 day')).' '."%02d:59:59"."'",$i,$i);
if ($res=mysql_query($sql)){
list($$tmp)=mysql_fetch_row($res);
$$tmp = empty($$tmp) ? "0" : $$tmp;
mysql_free_result($res);
}
}
for($i = 0;$i <24;$i++){
$tmp = 'klzr';
$tmp .= $i;
$$tmp = "0";
$sql = sprintf("select sum(money) from kl where     shijian>='".date('Y-m-d',strtotime('-1 day')).' '."%02d:00:00"."' and shijian<='".date('Y-m-d',strtotime('-1 day')).' '."%02d:59:59"."'",$i,$i);
if ($res=mysql_query($sql)){
list($$tmp)=mysql_fetch_row($res);
$$tmp = empty($$tmp) ? "0" : $$tmp;
mysql_free_result($res);
}
}
for($i = 0;$i <24;$i++){
$tmp = 'kljr';
$tmp .= $i;
$$tmp = "0";
$sql = sprintf("select sum(money) from kl where      shijian>='".date('Y-m-d').' '."%02d:00:00"."' and shijian<='".date('Y-m-d').' '."%02d:59:59"."'",$i,$i);
if ($res=mysql_query($sql)){
list($$tmp)=mysql_fetch_row($res);
$$tmp = empty($$tmp) ? "0" : $$tmp;
mysql_free_result($res);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>主页</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script type="text/javascript" src="/2019newui/js/Chart.min.js"></script>
<link rel="stylesheet" href="/layui/css/houtai.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/font-awesome.min.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/admin-1.css" media="all">
<script>
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : ["0点","1点","2点","3点","4点","5点","6点","7点","8点","9点","10点","11点","12点","13点","14点","15点","16点","17点","18点","19点","20点","21点","22点","23点"],
datasets : [
{
label: "My First dataset",
fillColor : "rgba(51,204,113,0.1)",
strokeColor : "rgba(51,204,113,1)",
pointColor : "rgba(51,204,113,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : ["<?php echo round($sj0,2)?>","<?php echo round($sj1,2)?>","<?php echo round($sj2,2)?>","<?php echo round($sj3,2)?>","<?php echo round($sj4,2)?>","<?php echo round($sj5,2)?>","<?php echo round($sj6,2)?>","<?php echo round($sj7,2)?>","<?php echo round($sj8,2)?>","<?php echo round($sj9,2)?>","<?php echo round($sj10,2)?>","<?php echo round($sj11,2)?>","<?php echo round($sj12,2)?>","<?php echo round($sj13,2)?>","<?php echo round($sj14,2)?>","<?php echo round($sj15,2)?>","<?php echo round($sj16,2)?>","<?php echo round($sj17,2)?>","<?php echo round($sj18,2)?>","<?php echo round($sj19,2)?>","<?php echo round($sj20,2)?>","<?php echo round($sj21,2)?>","<?php echo round($sj22,2)?>","<?php echo round($sj23,2)?>"]
}
,
{
label: "My Second dataset",
fillColor : "rgba(138,140,115,0.2)",
strokeColor : "rgba(238,153,34,1)",
pointColor : "rgba(238,153,34,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(151,187,205,1)",
data : ["<?php echo round($dj0,2)?>","<?php echo round($dj1,2)?>","<?php echo round($dj2,2)?>","<?php echo round($dj3,2)?>","<?php echo round($dj4,2)?>","<?php echo round($dj5,2)?>","<?php echo round($dj6,2)?>","<?php echo round($dj7,2)?>","<?php echo round($dj8,2)?>","<?php echo round($dj9,2)?>","<?php echo round($dj10,2)?>","<?php echo round($dj11,2)?>","<?php echo round($dj12,2)?>","<?php echo round($dj13,2)?>","<?php echo round($dj14,2)?>","<?php echo round($dj15,2)?>","<?php echo round($dj16,2)?>","<?php echo round($dj17,2)?>","<?php echo round($dj18,2)?>","<?php echo round($dj19,2)?>","<?php echo round($dj20,2)?>","<?php echo round($dj21,2)?>","<?php echo round($dj22,2)?>","<?php echo round($dj23,2)?>"]
}

,
{
label: "My Second dataset",
fillColor : "rgba(138,140,115,0.2)",
strokeColor : "rgba(255,100,97,1)",
pointColor : "rgba(255,100,97,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(151,187,205,1)",
data : ["<?php echo round($kljr0,2)?>","<?php echo round($kljr1,2)?>","<?php echo round($kljr2,2)?>","<?php echo round($kljr3,2)?>","<?php echo round($kljr4,2)?>","<?php echo round($kljr5,2)?>","<?php echo round($kljr6,2)?>","<?php echo round($kljr7,2)?>","<?php echo round($kljr8,2)?>","<?php echo round($kljr9,2)?>","<?php echo round($kljr10,2)?>","<?php echo round($kljr11,2)?>","<?php echo round($kljr12,2)?>","<?php echo round($kljr13,2)?>","<?php echo round($kljr14,2)?>","<?php echo round($kljr15,2)?>","<?php echo round($kljr16,2)?>","<?php echo round($kljr17,2)?>","<?php echo round($kljr18,2)?>","<?php echo round($kljr19,2)?>","<?php echo round($kljr20,2)?>","<?php echo round($kljr21,2)?>","<?php echo round($kljr22,2)?>","<?php echo round($kljr23,2)?>"]
}

,
{
label: "My Second dataset",
fillColor : "rgba(138,140,115,0.2)",
strokeColor : "rgba(150,9,243,1)",
pointColor : "rgba(150,9,243,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(151,187,205,1)",
data : ["<?php echo round($klzr0,2)?>","<?php echo round($klzr1,2)?>","<?php echo round($klzr2,2)?>","<?php echo round($klzr3,2)?>","<?php echo round($klzr4,2)?>","<?php echo round($klzr5,2)?>","<?php echo round($klzr6,2)?>","<?php echo round($klzr7,2)?>","<?php echo round($klzr8,2)?>","<?php echo round($klzr9,2)?>","<?php echo round($klzr10,2)?>","<?php echo round($klzr11,2)?>","<?php echo round($klzr12,2)?>","<?php echo round($klzr13,2)?>","<?php echo round($klzr14,2)?>","<?php echo round($klzr15,2)?>","<?php echo round($klzr16,2)?>","<?php echo round($klzr17,2)?>","<?php echo round($klzr18,2)?>","<?php echo round($klzr19,2)?>","<?php echo round($klzr20,2)?>","<?php echo round($klzr21,2)?>","<?php echo round($klzr22,2)?>","<?php echo round($klzr23,2)?>"]
}
]
}
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}
</script>
</head>
<body class="layui-layout-body" style="overflow-y:visible;">
<div class="layadmin-tabsbody-item layui-show">
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md8">
<div class="layui-row layui-col-space15">
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">订单数据</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 280px;">
<div carousel-item="">
<ul class="layui-row layui-col-space10 layui-this">
<?php 
$sql = mysql_query("SELECT * FROM dingdan WHERE     shijian like '%".$day."%' ");
$daydd = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM dingdan WHERE     shijian like '%".$zuori."%'");
$zuoridd = mysql_num_rows($sql);
$sql="select sum(money) from dingdan where     shijian like '%".$day."%'";
if ($res=mysql_query($sql)){
list($money1)=mysql_fetch_row($res);
mysql_free_result($res);
} 
$sql="select sum(money) from dingdan where    shijian like '%".$zuori."%'";
if ($res=mysql_query($sql)){
list($money2)=mysql_fetch_row($res);
mysql_free_result($res);
} 
?> 
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>今日订单笔数</h3><p><cite><?php if($daydd == null){ ?> 0 <?php }else{  ?> <?php echo $daydd?> <?php } ?>   笔</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>今日订单金额</h3><p><cite>￥ <?php if($money1 == null){ ?> 0 <?php }else{  ?> <?php $xs1=round($money1,2);echo $xs1;?> <?php } ?> 元</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>昨日订单笔数</h3><p><cite><?php if($zuoridd == null){ ?> 0 <?php }else{  ?> <?php echo $zuoridd?> <?php } ?>   笔</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>昨日订单金额</h3><p><cite>￥ <?php if($money2 == null){ ?> 0 <?php }else{  ?> <?php $xs2=round($money2,2);echo $xs2;?>  <?php } ?>   元</cite></p></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">扣量数据</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 280px;">
<div carousel-item="">
<ul class="layui-row layui-col-space10 layui-this">
<?php 
$sql = mysql_query("SELECT * FROM kl WHERE   shijian like '%".$day."%' ");
$daydd = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM kl WHERE    shijian like '%".$zuori."%'");
$zuoridd = mysql_num_rows($sql);
$sql="select sum(money) from kl where     shijian like '%".$day."%'";
if ($res=mysql_query($sql)){
list($money1)=mysql_fetch_row($res);
mysql_free_result($res);
} 
$sql="select sum(money) from kl where     shijian like '%".$zuori."%'";
if ($res=mysql_query($sql)){
list($money2)=mysql_fetch_row($res);
mysql_free_result($res);
} 
?> 
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>今日扣量笔数</h3><p><cite><?php if($daydd == null){ ?> 0 <?php }else{  ?> <?php echo $daydd?> <?php } ?>   笔</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>今日扣量金额</h3><p><cite>￥ <?php if($money1 == null){ ?> 0 <?php }else{  ?> <?php $xs1=round($money1,2);echo $xs1;?> <?php } ?> 元</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>昨日扣量笔数</h3><p><cite><?php if($zuoridd == null){ ?> 0 <?php }else{  ?> <?php echo $zuoridd?> <?php } ?>   笔</cite></p></a></li>
<li class="layui-col-xs6"><a lay-href="" class="layadmin-backlog-body"><h3>昨日扣量金额</h3><p><cite>￥ <?php if($money2 == null){ ?> 0 <?php }else{  ?> <?php $xs2=round($money2,2);echo $xs2;?>  <?php } ?>   元</cite></p></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">昨日同期收益对比</div>
<div class="layui-card-body"  style="height: 430px;">
<div  style="width:99%">
<p class="charttitle">
<span style="display:inline-block;margin-right:5px;width:16px;height:16px;background-color:#33CC71"></span>今日订单
<span style="display:inline-block;margin-right:5px;width:16px;height:16px;background-color:#EE9922"></span>昨日订单
<span style="display:inline-block;margin-right:5px;width:16px;height:16px;background-color:#FF6461"></span>今日扣量
<span style="display:inline-block;margin-right:5px;width:16px;height:16px;background-color:#9609F3"></span>昨日扣量
</p>
<canvas id="canvas" height="180" width="500" ></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-card">
<div class="layui-card-header">版本信息</div>
<div class="layui-card-body layui-text">
<table class="layui-table">
<colgroup>
<col width="100">
<col>
</colgroup>
<tbody>
<tr><td>当前版本</td><td>niuds_1.5.191105</td></tr>
<tr><td>系统名称</td><td>牛赏视频付费打赏程序</td></tr>
<tr><td>官网</td><td>www.niuds.net</td></tr>
</tbody>
</table>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
官方公告
</div>
<div class="layui-card-body layui-text layadmin-text">
<p>只作为付费知识视频使用，不得用于非法用途</p>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">数据统计</div>
<div class="layui-card-body layui-text">
<table class="layui-table">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<?php
$sql = mysql_query("SELECT * FROM shipin");
$ggbs = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM daili");
$dlbs = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM user");
$userbs = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM tglink");
$linkbs = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM ts");
$tsbs= mysql_num_rows($sql);
$sql="select sum(cs) from shipin";
if ($res=mysql_query($sql)){
list($cs)=mysql_fetch_row($res);
mysql_free_result($res);
} 
$sql = mysql_query("SELECT * FROM pay WHERE  zt='等待支付'");
$paycs= mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM dingdan");
$ddcs= mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM kl");
$klcs= mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM yqm");
$ycs= mysql_num_rows($sql);
?>
<tr><td>公共片库</td><td> <?php if($ggbs==null){?>0<?php }else{?><?php echo $ggbs?><?php }?> 部</td></tr>
<tr><td>代理片库</td><td><?php if($dlbs==null){?>0<?php }else{?><?php echo $dlbs?><?php }?> 部</td></tr>
<tr><td>代理数量</td><td><?php if($userbs==null){?>0<?php }else{?><?php echo $userbs?><?php }?> 个</td></tr>
<tr><td>推广链接</td><td><?php if($linkbs==null){?>0<?php }else{?><?php echo $linkbs?><?php }?> 条</td></tr>
<tr><td>投诉数量</td><td><?php if($tsbs==null){?>0<?php }else{?><?php echo $tsbs?><?php }?> 条</td></tr>
<tr><td>打赏笔数</td><td><?php if($cs==null){?>0<?php }else{?><?php echo $cs?><?php }?> 条</td></tr>
<tr><td>待结算笔数</td><td><?php if($paycs==null){?>0<?php }else{?><?php echo $paycs?><?php }?> 笔</td></tr>
<tr><td>订单笔数</td><td><?php if($ddcs==null){?>0<?php }else{?><?php echo $ddcs?><?php }?> 笔</td></tr>
<tr><td>扣量笔数</td><td><?php if($klcs==null){?>0<?php }else{?><?php echo $klcs?><?php }?> 笔</td></tr>
<tr><td>邀请码</td><td><?php if($ycs==null){?>0<?php }else{?><?php echo $ycs?><?php }?> 个</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>