147 lines
4.9 KiB
PHP
147 lines
4.9 KiB
PHP
<?php
|
|
include("../includes/common.php");
|
|
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
|
$title='历史订单记录';
|
|
include './head.php';
|
|
?>
|
|
<?php
|
|
if(!$DB->getRow("SHOW TABLES LIKE 'pay_order_old'")){
|
|
showmsg('历史订单表不存在');
|
|
}
|
|
function do_callback($data){
|
|
global $DB,$userrow;
|
|
if($data['status']>=1)$trade_status='TRADE_SUCCESS';
|
|
else $trade_status='TRADE_FAIL';
|
|
$array=array('pid'=>$data['pid'],'trade_no'=>$data['trade_no'],'out_trade_no'=>$data['out_trade_no'],'type'=>$data['type'],'name'=>$data['name'],'money'=>$data['money'],'trade_status'=>$trade_status);
|
|
$arg=argSort(paraFilter($array));
|
|
$prestr=createLinkstring($arg);
|
|
$urlstr=createLinkstringUrlencode($arg);
|
|
$sign=md5Sign($prestr, $userrow['key']);
|
|
if(strpos($data['notify_url'],'?'))
|
|
$url=$data['notify_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
|
else
|
|
$url=$data['notify_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
|
return $url;
|
|
}
|
|
|
|
if(!empty($_GET['type']) && !empty($_GET['kw'])) {
|
|
$kw=daddslashes($_GET['kw']);
|
|
if($_GET['type']==1)$sql=" and trade_no='$kw'";
|
|
elseif($_GET['type']==2)$sql=" and out_trade_no='$kw'";
|
|
elseif($_GET['type']==3)$sql=" and name='$kw'";
|
|
elseif($_GET['type']==4)$sql=" and money='$kw'";
|
|
elseif($_GET['type']==5)$sql=" and type='$kw'";
|
|
else $sql="";
|
|
$link='&type='.$_GET['type'].'&kw='.$_GET['kw'];
|
|
}else{
|
|
$sql="";
|
|
$link='';
|
|
}
|
|
$numrows=$DB->getColumn("SELECT count(*) from pay_order_old WHERE pid={$pid}{$sql}");
|
|
$pagesize=30;
|
|
$pages=intval($numrows/$pagesize);
|
|
if ($numrows%$pagesize)
|
|
{
|
|
$pages++;
|
|
}
|
|
if (isset($_GET['page'])){
|
|
$page=intval($_GET['page']);
|
|
}
|
|
else{
|
|
$page=1;
|
|
}
|
|
$offset=$pagesize*($page - 1);
|
|
|
|
$list=$DB->getAll("SELECT * FROM pay_order_old WHERE pid={$pid}{$sql} order by trade_no desc limit $offset,$pagesize");
|
|
|
|
?>
|
|
<div id="content" class="app-content" role="main">
|
|
<div class="app-content-body ">
|
|
|
|
<div class="bg-light lter b-b wrapper-md hidden-print">
|
|
<h1 class="m-n font-thin h3">历史订单记录</h1>
|
|
</div>
|
|
<div class="wrapper-md control">
|
|
<?php if(isset($msg)){?>
|
|
<div class="alert alert-info">
|
|
<?php echo $msg?>
|
|
</div>
|
|
<?php }?>
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading font-bold">
|
|
订单记录 (<?php echo $numrows?>)
|
|
</div>
|
|
<div class="row wrapper">
|
|
<div class="col-sm-5 m-b-xs">
|
|
<form action="order_old.php" method="GET" class="form-inline">
|
|
<div class="form-group">
|
|
<select class="input-sm form-control" name="type">
|
|
<option value="1">交易号</option>
|
|
<option value="2">商户订单号</option>
|
|
<option value="3">商品名称</option>
|
|
<option value="4">商品金额</option>
|
|
<option value="5">支付方式</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="text" class="input-sm form-control" name="kw" placeholder="搜索内容">
|
|
</div>
|
|
<div class="form-group">
|
|
<button class="btn btn-sm btn-default" type="submit">搜索</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead><tr><th>交易号/商户订单号</th><th>商品名称</th><th>商品金额</th><th>支付方式</th><th>创建时间/完成时间</th><th>状态</th><th>操作</th></tr></thead>
|
|
<tbody>
|
|
<?php
|
|
foreach($list as $res){
|
|
echo '<tr><td>'.$res['trade_no'].'<br/>'.$res['out_trade_no'].'</td><td>'.$res['name'].'</td><td>¥ <b>'.$res['money'].'</b></td><td> <b>'.$res['type'].'</b></td><td>'.$res['addtime'].'<br/>'.$res['endtime'].'</td><td>'.($res['status']==1?'<font color=green>已完成</font>':'<font color=red>未完成</font>').'</td><td><a href="'.do_callback($res).'" target="_blank" rel="noreferrer">重新通知</a></td></tr>';
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<footer class="panel-footer">
|
|
<?php
|
|
echo'<ul class="pagination">';
|
|
$first=1;
|
|
$prev=$page-1;
|
|
$next=$page+1;
|
|
$last=$pages;
|
|
if ($page>1)
|
|
{
|
|
echo '<li><a href="order_old.php?page='.$first.$link.'">首页</a></li>';
|
|
echo '<li><a href="order_old.php?page='.$prev.$link.'">«</a></li>';
|
|
} else {
|
|
echo '<li class="disabled"><a>首页</a></li>';
|
|
echo '<li class="disabled"><a>«</a></li>';
|
|
}
|
|
for ($i=1;$i<$page;$i++)
|
|
echo '<li><a href="order_old.php?page='.$i.$link.'">'.$i .'</a></li>';
|
|
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
|
if($pages>=10)$pages=10;
|
|
for ($i=$page+1;$i<=$pages;$i++)
|
|
echo '<li><a href="order_old.php?page='.$i.$link.'">'.$i .'</a></li>';
|
|
echo '';
|
|
if ($page<$pages)
|
|
{
|
|
echo '<li><a href="order_old.php?page='.$next.$link.'">»</a></li>';
|
|
echo '<li><a href="order_old.php?page='.$last.$link.'">尾页</a></li>';
|
|
} else {
|
|
echo '<li class="disabled"><a>»</a></li>';
|
|
echo '<li class="disabled"><a>尾页</a></li>';
|
|
}
|
|
echo'</ul>';
|
|
#分页
|
|
?>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'foot.php';?>
|