<?php
/**
 * QQ代刷管理中心
**/
include "../includes/common.php";
$title = 'QQ代刷网后台管理中心';
include './head.php';
if ($islogin == 1) {
} else {
	exit("<script language='javascript'>window.location.href='./login.php';</script>");
}
$data = get_curl($payapi . 'api.php?act=query&pid=' . $conf['epay_pid'] . '&key=' . $conf['epay_key'] . '&url=' . $_SERVER['HTTP_HOST'], 0, 0, 0, 0, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.4355.400 QQBrowser/9.7.12672.400');
$time = date("Y-m-d") . ' 00:00:01';
$arr = json_decode($data, true);
$count4 = $DB->count("SELECT count(*) from shua_orders WHERE  `addtime` > '$time'");
$count2 = $DB->count("SELECT count(*) from shua_orders where status=1");
$count3 = $DB->count("SELECT count(*) from shua_orders where status=0");
$count1 = $DB->count("SELECT count(*) from shua_orders");
$mysqlversion = $DB->count("select VERSION()");
$strtotime = strtotime($conf['build']);
//获取开始统计的日期的时间戳
$now = time();
//当前的时间戳
$yxts = ceil(($now - $strtotime) / 86400);
//取相差值然后除于24小时(86400秒)
?>

<div class="container" style="padding-top:70px;">
    <div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
      <div class="panel panel-success">
<div class="panel-heading" style="background:<?php 
echo $conf['panel_color'] ? $conf['panel_color'] : '#5ccdde';
?>">
        <h3 class="panel-title"><font color="#fff"><b><center>今日订单：<?php 
echo $count4;
?>个，加油!</center></b></font></h3></div>
          <ul class="list-group">
<table class="table table-bordered">
<tbody>
<tr height="25">
	<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-tint"></span>订单总数</b></br><?php 
echo $count1;
?>条</font></td>
    <td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>已处理订单</b></br></span><?php 
echo $count2;
?>条</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-exclamation-sign"></i>待处理订单</b></span></br><?php 
echo $count3;
?>条</font></td>
</tr>
<tr height="25">
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-time"></i>运营天数</b></br><?php 
echo $yxts;
?>天</font>
</td>
<?php 
$count8 = $DB->count("SELECT count(*) FROM `shua_tixian` WHERE `status` = 0");
?>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>待处理提现</b></span></br><?php 
echo $count8;
?>条</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-exclamation-sign"></i>后台资金</b></span></br><?php 
echo $arr['money'];
?>元</font></td>
</tr>
<tr height="25">
<?php 
$time = date("Y-m-d") . ' 00:00:01';
$count1 = $DB->count("SELECT sum(point) FROM `shua_points` WHERE `action` LIKE '提成' AND `addtime` > '$time'");
$count2 = round($count1, 2);
$count3 = $DB->count("SELECT count(*) FROM `shua_site` WHERE `addtime` > '$time'");
$count11 = $DB->count("SELECT sum(money)  FROM `shua_pay` WHERE `addtime` > '$time' AND `name` != '在线充值余额' AND `status` = 1");
$count12 = round($count11, 2);
?>
<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-check"></span>今日分站提成</b></br><?php 
echo $count2;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>今日下单金额</b></br></span><?php 
echo $count12;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>今日新开分站</b></span></br><?php 
echo $count3;
?>个</font></td>
</tr>
<tr height="25">
<?php 
$time = date("Y-m-d") . ' 00:00:01';
$count5 = $DB->count("SELECT sum(point) FROM `shua_points` WHERE `action` LIKE '提成' AND `addtime` > '2017-01-01 00:00:00'");
$count6 = round($count5, 2);
$count9 = $DB->count("SELECT sum(money)  FROM `shua_pay` WHERE `status` = 1");
$count10 = round($count9, 2);
$fenzhan_count = $DB->count("SELECT count(*) FROM shua_site");
?>
<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-check"></span>分站总提成</b></br><?php 
echo $count6;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>在线支付总数</b></br></span><?php 
echo $count10;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>分站总数</b></span></br><?php 
echo $fenzhan_count;
?>个</font></td>
</tr>
<tr height="25">
<?php 
$count13 = $DB->count("SELECT sum(rmb) FROM `shua_site` WHERE `zid` != 2 AND `rmb` > 0");
$count14 = round($count13, 2);
$count15 = $DB->count("SELECT sum(realmoney) FROM `shua_tixian` WHERE `status` = 0");
$count16 = round($count15, 2);
$count17 = $DB->count("SELECT sum(realmoney) FROM `shua_tixian` WHERE `status` = 1");
$count18 = round($count17, 2);
?>
<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-check"></span>分站总资金</b></br><?php 
echo $count14;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>待处理提现</b></br></span><?php 
echo $count16;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>已处理提现</b></span></br><?php 
echo $count18;
?>元</font></td>
</tr>
<tr height="25">
<?php 
$thtime = date("Y-m-d") . ' 00:00:00';
$rs = $DB->query("SELECT point,action,addtime from shua_points where  action='充值'");
$count21 = 0;
$count22 = 0;
$count23 = 0;
$count24 = 0;
while ($row = $DB->fetch($rs)) {
	$count23 += $row['point'];
	if ($row['addtime'] >= $thtime) {
		$count21 += $row['point'];
	}
}
$rs = $DB->query("SELECT point,action,addtime from shua_points where  action='消费'");
while ($row = $DB->fetch($rs)) {
	$count24 += $row['point'];
	if ($row['addtime'] >= $thtime) {
		$count22 += $row['point'];
	}
}
$count30 = $DB->count("SELECT sum(money) FROM `shua_pay` WHERE `type` = 'alipay' AND `addtime` > '$thtime' AND `status` = 1 ORDER BY `addtime` DESC");
$count31 = round($count30, 2);
?>
<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-check"></span>分站今日充值</b></br><?php 
echo round($count21, 2);
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>分站今日消费</b></br></span><?php 
echo round($count22, 2);
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>支付宝交易额</b></span></br><?php 
echo $count31;
?>元</font></td>
</tr>
<tr height="25">
<?php 
$thtime = date("Y-m-d") . ' 00:00:00';
$count30 = $DB->count("SELECT sum(money) FROM `shua_pay` WHERE `type` = 'qqpay' AND `addtime` > '$thtime' AND `status` = 1 ORDER BY `addtime` DESC");
$count31 = round($count30, 2);
$count32 = $DB->count("SELECT sum(money) FROM `shua_pay` WHERE `type` = 'wxpay' AND `addtime` > '$thtime' AND `status` = 1 ORDER BY `addtime` DESC");
$count33 = round($count32, 2);
$count34 = $DB->count("SELECT sum(money) FROM `shua_pay` WHERE `type` = 'alipay' AND `addtime` > '$thtime' AND `status` = 1 ORDER BY `addtime` DESC");
$count35 = $DB->count("SELECT count(*) FROM shua_orders where zid>1 and addtime > '{$thtime}'");
?>
<td align="center"><font color="#808080"><b><span class="glyphicon glyphicon-check"></span>QQ钱包交易额</b></br><?php 
echo $count31;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>微信交易额</b></br></span><?php 
echo $count33;
?>元</font></td>
<td align="center"><font color="#808080"><b><i class="glyphicon glyphicon-check"></i>分站今日下单</b></span></br><?php 
echo $count35;
?>条</font></td>
</tr>
<tr height="25">
<td align="center"><a href="../index.php"class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-globe"></span>网站首页</a></td>
<td align="center"><a href="list.php"class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-calendar"></span>订单管理</a></td>
<td align="center"><a href="kmlist.php"class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-list"></span>卡密管理</a></td></tr>
<tr height="25">
<td align="center"><a href="shoplist.php"class="btn btn-xs btn-success"><span class="glyphicon glyphicon-globe"></span>商品管理</a></td>
<td align="center"><a href="set.php?mod=site"class="btn btn-xs btn-success"><span class="glyphicon glyphicon-globe"></span>网站信息</a></td>
<td align="center"><a href="sitelist.php"class="btn btn-xs btn-success"><span class="glyphicon glyphicon-globe"></span>分站管理</a></td>
</tr>
<tr height="25">
<td align="center"><a href="set.php?mod=pay"class="btn btn-info btn-xs"><span class="glyphicon glyphicon-globe"></span>支付配置</a></td>
<td align="center"><a href="list.php?mod=epay_order"class="btn btn-info btn-xs"><span class="glyphicon glyphicon-globe"></span>订单记录</a></td>
<td align="center"><a href="set.php?mod=epay"class="btn btn-info btn-xs"><span class="glyphicon glyphicon-globe"></span>结算记录</a></td>
</tr>
</table>
</tbody>
</ul>
</div>
<ul class="list-group">
	<li class="list-group-item">
		<b>当前版本：</b><font STYLE="color: red;">柚子全解修复彩虹5.0</font>
	</li>
	<li class="list-group-item">
		<b>代刷网：</b><font style="color: green;"><?php 
echo $_SERVER['HTTP_HOST'];
?></font>
	</li>
	<li class="list-group-item">
		<b>柚子QQ：</b><font style="color: green;">2985682472</font>
	</li>
	<li class="list-group-item">
		<b>梦尽互联：</b><font style="color: green;">idc.b-aidu.cn  梦尽互联主营免备案国内国外，秒赞，主机内有免费主机</font>
	</li>
</ul>
</div>
<script src="//cdn.dkfirst.cn/snow.js"></script>
</div>
<?php 
$res = update_version();
if ($_COOKIE['check_update'] != 1) {
	if ($res['code'] == 1) {
		?>
<script>
layer.alert('发现新版本，点击确定进入更新页面',function(){
	window.location.href="update.php";
});
</script>
<?php 
		setcookie('check_update', 1);
	}
}
?>
<style type="text/css"> <!-- body { background-image: url(../assets/img/bj.png); background-size:cover-repeat;background-attachment:fixed; } --> </style>
</body>
</html>