<?php
error_reporting(0); 
include("../../config/qiantai.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$username=ubo($_SESSION['username']);
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$type="where name='$username'";
$userip=queryall(userip,$type);
//绘制图表
for($i = 0;$i <24;$i++){
$tmp = 'sj';
$tmp .= $i;
$$tmp = "0";
$sql = sprintf("select sum(money) from dingdan where userid='$userid' and   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 userid='$userid'  and   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);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta 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, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="/2019newui/qiantai/css/x-admin.css" media="all">
<link rel="stylesheet" href="/2019newui/qiantai/css/bootstrap.css" media="all">
<script type="text/javascript" src="/2019newui/js/Chart.min.js"></script>
<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(138,140,115,1)",
pointColor : "rgba(138,140,115,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)?>"]
}

]
}
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}
</script>
</head>
<body>
<style type="text/css">
legend { display: block; width:100px; border-bottom:0px; font-family: "Microsoft YaHei","Helvetica Neue";}
legend a{ color:#666;} legend a:hover{ text-decoration:none;}
.layui-table{ font-family: "Microsoft YaHei","Helvetica Neue";}
</style>
<div class="x-body">
<blockquote class="layui-elem-quote" style="font-size:14px;">
您好,【<?php echo $userip[name]?>】
</blockquote>
<fieldset class="layui-elem-field"><legend>代理说明</legend>
<div class="layui-field-box">
<p>1、夜间不处理任何提现申请，财务打款时间更改为周一到周五下午13点到15点统一处理提现申请</p>
<p>2、周末休息如有提现等到周一上班处理请给位代理们互相告知！</p>
<p>3、代理将提现金额以整数提,请各位代理填写好个人的收款方式！</p>
<p>4、只有在历史总营业额满 <span style="font-size:24px;color:#ff0000"><?php echo $yqm?></span> 元时才会自动授权邀请码功能！</p>
<p>5、为了你的安全，超过<span style="font-size:24px;color:#ff0000"><?php echo $txmoney?></span>元请联系客服安全提现！ 微信:<span style="font-size:24px;color:#ff0000"><?php echo $weixin?></span></p>
</div>
</fieldset>
<fieldset class="layui-elem-field layui-field-title" style=""><legend>交易统计</legend></fieldset>
<?php 
$sql = mysql_query("SELECT * FROM dingdan WHERE  userid='$userid' and  shijian like '%".$day."%' ");
$daydd = mysql_num_rows($sql);
$sql = mysql_query("SELECT * FROM dingdan WHERE  userid='$userid'  and  shijian like '%".$zuori."%'");
$zuoridd = mysql_num_rows($sql);
$sql="select sum(money) from dingdan where  userid='$userid' and  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  userid='$userid' and  shijian like '%".$zuori."%'";
if ($res=mysql_query($sql)){
list($money2)=mysql_fetch_row($res);
mysql_free_result($res);
} 
?> 
<div class="container-fluid ygyd-wrapper"> 
<div class="row" style="margin-top:-20px;">
<div class="col-xs-6 col-sm-4 col-md-3">
<section class="panel">
<div class="symbol bgcolor-blue"><i class="layui-icon" >&#xF157;</i></div>
<div class="value tab-menu" ><h1>￥ <?php if($money1 == null){ ?> 0 <?php }else{  ?> <?php $xs1=round($money1,2);echo $xs1;?> <?php } ?> 元</h1><span>今日打赏金额</span></div>
</section>
</div>
<div class="col-xs-6 col-sm-4 col-md-3">
<section class="panel">
<div class="symbol bgcolor-commred"><i class="layui-icon">&#xF046;</i></div>
<div class="value tab-menu"><h1><?php if($daydd == null){ ?> 0 <?php }else{  ?> <?php echo $daydd?> <?php } ?>   笔 </h1><span>今日打赏笔数</span></div>
</section>
</div>
<div class="col-xs-6 col-sm-4 col-md-3">
<section class="panel">
<div class="symbol bgcolor-dark-green"><i class="layui-icon" >&#xF157;</i></div>
<div class="value tab-menu"><h1>￥ <?php if($money2 == null){ ?> 0 <?php }else{  ?> <?php $xs2=round($money2,2);echo $xs2;?>  <?php } ?>   元</h1><span>昨日打赏金额</span></a></div>
</section>
</div>
<div class="col-xs-6 col-sm-4 col-md-3">
<section class="panel">
<div class="symbol bgcolor-yellow-green"><i class="layui-icon">&#xF046;</i></div>
<div class="value tab-menu"><h1><?php if($zuoridd == null){ ?> 0 <?php }else{  ?> <?php echo $zuoridd?> <?php } ?>   笔</h1><span>昨日打赏笔数</span></a></div>
</section>
</div>
</div>
<fieldset class="layui-elem-field layui-field-title site-title" style="margin-top:10px;"><legend><a name="default">数据统计</a></legend></fieldset>
<div  style="margin-top:-40px;margin-left:-20px;">
<div class="container-fluid">
<canvas id="canvas" height="120" width="620"  ></canvas>
</div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
</div>
</body>
</html>