作者 anyv
1 个管道 的构建 通过 耗费 0 秒

搜索

... ... @@ -70,7 +70,20 @@ class HexiaoController extends AdminBaseController{
//已核销页
public function yihexiao(){
$data = Db::name('coupons_user') -> alias('a') -> join('members_user b','a.uid=b.id','LEFT') -> where('a.state=1') -> order('a.time desc') -> select() -> toArray();
if($this ->request -> isPost()){
$where = [
"a.state" => 1
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.time'] = [['>=',$start_time],['<=',$end_time]];
}
$data = Db::name('coupons_user') -> alias('a') -> join('members_user b','a.uid=b.id','LEFT') -> where($where) -> order('a.time desc') -> select() -> toArray();
}else{
$data = Db::name('coupons_user') -> alias('a') -> join('members_user b','a.uid=b.id','LEFT') -> where('a.state=1') -> order('a.time desc') -> select() -> toArray();
}
foreach ($data as $key => $value) {
$quan = Db::name('coupons') -> where('id',$value['cid']) -> find();
$data[$key]['title'] = $quan['title'];
... ...
<include file="public@header" />
</head>
<body>
<table class="table table-bordered" style="margin:10px 10px;">
<caption>已核销</caption>
<thead>
<tr>
<th>姓名</th>
<th>优惠券</th>
<th>核销时间</th>
<th>核销码</th>
</tr>
</thead>
<tbody>
<volist name="data" id="vo" >
<tr>
<td>{$vo.name}</td>
<td>{$vo.title}</td>
<td>{$vo.time|date="Y-m-d H:i:s",###}</td>
<td>{$vo.code}</td>
</tr>
</volist>
<div class="wrap js-check-wrap">
<form class="well form-inline margin-top-20" method="post" action="{:url('Hexiao/yihexiao')}">&nbsp;&nbsp;&nbsp; &nbsp;
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Hexiao/yihexiao')}">清空</a>
</form>
<table class="table table-bordered" style="margin:10px 10px;">
<caption>已核销</caption>
<thead>
<tr>
<th>姓名</th>
<th>优惠券</th>
<th>核销时间</th>
<th>核销码</th>
</tr>
</thead>
<tbody>
<volist name="data" id="vo" >
<tr>
<td>{$vo.name}</td>
<td>{$vo.title}</td>
<td>{$vo.time|date="Y-m-d H:i:s",###}</td>
<td>{$vo.code}</td>
</tr>
</volist>
</tbody>
</table>
</tbody>
</table>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
\ No newline at end of file
... ...