页面执行时间太长,请各位大大帮忙看看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>订单统计</title>
<link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-ja.js" type="text/javascript"></script>
<script type='text/javascript' src='js/picnet.table.filter.min.js'></script>
<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="js/jquery.ui.position.js"></script>
<script type="text/javascript" src="js/jquery.ui.autocomplete.js"></script>
<!--<link rel="stylesheet" type="text/css" href="css/css.css" />-->
<!--<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>-->
<!--<link rel="stylesheet" type="text/css" href="css/style.css" />-->
<style type="text/css">
* {
padding:0;
margin:0;
}
body {
font-family:verdana;
font-size:12px;
margin-left: 0px;
margin-top: 0px;
}
.content {
width:1200px;
margin:20px 10px;
}
.content h1 {
font-family:'??';
font-size:18px;
padding-bottom:5px;
}
table {
width:100%;
}
th, td {
padding:6px 0;
}
th {
background-color:#accdf4;
color:#ffffff;
}
tr {
background-color:#FFFFFE;
}
.odd {
background-color:#FFFAFF;
}
.highlight {
background-color:#E0E0E0;
}
.STYLE1 {font-size: 14px}
.STYLE2 {font-size: 16px}
</style>
</head>
<body>
<?PHP
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->get_microtime();
}
function stop()
{
$this->StopTime = $this->get_microtime();
}
function spent()
{
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}
}
$runtime= new runtime;
$runtime->start();
include("conn.php");
$to_date=date('Y-m-d');
//按包装区域来统计邮件总数
function sale_address_package_statistics($date,$account,$package){
$sql="select `number` from `sale_orders` where `account`='$account' and date(`upload_date`) ='$date' GROUP BY `number`";
$Result = mysql_query($sql);
$number="(`number`='' ";
while($rs = mysql_fetch_array($Result))
{
$number.=" or `number`=".$rs[0];
}
$number.=")";
$sql_order_address="SELECT * FROM `sale_orders` T ";
$sql_order_address.="WHERE ".$number;
$sql_order_address.="AND `account` ='$account' ";
if($package=='MIX')
{$sql_order_address.="AND 1<(select count(*) from `sale_orders` where ".$number." AND `account` ='$account' AND `recipient_name`=T.`recipient_name` AND `ship_address_1`=T.`ship_address_1`) ";
}
else
{
$sql_order_address.="AND 1=(select count(*) from `sale_orders` where ".$number." AND `account` ='$account' AND `recipient_name`=T.`recipient_name` AND `ship_address_1`=T.`ship_address_1`) ";
$sql_order_address.="AND `package_area`='$package' ";
}
$sql_order_address.="GROUP BY `recipient_name` , `ship_address_1`";
$result_label = mysql_query($sql_order_address);
$order_address=mysql_affected_rows();
if(empty($order_address))
{
return 0;
}
else
{
return $order_address;
}
}
?>
<h2 class="top_title">订单统计</h2>
<div class="digg">
<table width="200" border="0" cellspacing="0">
<tr>
<td width="72%"><table width="95%" border="0" cellspacing="1" bgcolor="#dddddd">
<tr>
<td width="15%" align="center"> </td>
<td align="center" bgcolor="eeeeee" colspan="3">PM_AC</td>
<td align="center" bgcolor="eeeeee" colspan="3">CO_AC</td>
<td align="center" bgcolor="eeeeee" colspan="3">UK_AC</td>
<td align="center" bgcolor="eeeeee" colspan="3">UK_FR</td>
<td align="center" bgcolor="eeeeee" colspan="3">UK_DE</td>
</tr>
<tr>
<td width="25%" align="center"> </td>
<td width="5%" align="center" bgcolor="eeeeee">SZ</td>
<td width="5%" align="center" bgcolor="eeeeee">HK</td>
<td width="5%" align="center" bgcolor="eeeeee">MIX</td>
<td width="5%" align="center" bgcolor="eeeeee">SZ</td>
<td width="5%" align="center" bgcolor="eeeeee">HK</td>
<td width="5%" align="center" bgcolor="eeeeee">MIX</td>
<td width="5%" align="center" bgcolor="eeeeee">SZ</td>
<td width="5%" align="center" bgcolor="eeeeee">HK</td>
<td width="5%" align="center" bgcolor="eeeeee">MIX</td>
<td width="5%" align="center" bgcolor="eeeeee">SZ</td>
<td width="5%" align="center" bgcolor="eeeeee">HK</td>
<td width="5%" align="center" bgcolor="eeeeee">MIX</td>
<td width="5%" align="center" bgcolor="eeeeee">SZ</td>
<td width="5%" align="center" bgcolor="eeeeee">HK</td>
<td width="5%" align="center" bgcolor="eeeeee">MIX</td>
</tr>
<tr>
<td align="center" bgcolor="eeeeee"><span class="STYLE1"><?PHP echo $to_date;?></span></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'PM_AC','SZ'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'PM_AC','HK'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'PM_AC','MIX'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'CO_AC','SZ'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'CO_AC','HK'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'CO_AC','MIX') ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_AC','SZ'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_AC','HK'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_AC','MIX'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_FR','SZ'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_FR','HK'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_FR','MIX'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_DE','SZ'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_DE','HK'); ?></td>
<td align="center"><?PHP echo sale_address_package_statistics($to_date,'UK_DE','MIX'); ?></td>
</tr>
</table>
<?PHP $runtime->stop();
$runtimea= new runtime;
$runtimea->start();
?>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
<td width="28%"></td>
</tr>
</table>
</div>
<?PHP $runtimea->stop();
echo "邮件统计页面执行时间: ".$runtime->spent()." 毫秒,订单统计页面执行时间:".$runtimea->spent()." 毫秒"; ?>
</body>
</html>