使用tp5的Db类进行操作
$count是符合条件的数据量
<div class="col-xs-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>搜索</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="table-responsive">
<form class="form-search" method="get" action="<?=url('automatic.order/integarlOrder')?>" role="form">
<table>
<tr>
<td>联系人:<input class="form-control" name="name" id="name"
value="<?=$search['name']?>" type="text" placeholder="请输入联系人"
style=" width:200px"/></td>
<td>手机号码:<input class="form-control" name="mobile" id="mobile"
value="<?=$search['mobile']?>" type="text" placeholder="请输入手机号码"
style=" width:200px"/></td>
<td>
<div class="input-group">
<button type="submit" style="margin-top: 42%"
class="btn form-control btn-sm btn-primary">
搜索
</button>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
/*
author:咔咔
address:陕西西安
wechat:fangkangfk
*/
public function vipOrder()
{
$where = $search = [];
$search['name'] = $this->request->param('name');
if (!empty($search['name'])) {
$where['nickname'] = array('LIKE', '%' . $search['name'] . '%');
}
$search['mobile'] = $this->request->param('mobile');
if (!empty($search['mobile'])) {
$where['mobile'] = array('LIKE', '%' . $search['mobile'] . '%');
}
$where['scale'] = 1;
$count = Db::table('wxb_move_order')
->where($where)
->alias('o')
->join('wxb_move_user u','o.user_id = u.id')
->count();
$list = Db::table('wxb_move_order')
->where($where)
->alias('o')
->join('wxb_move_user u','o.user_id = u.id')
->paginate(3, $count);
$page = $list->render();
$this->assign('page', $page);
$this->assign('list', $list);
$this->assign('search', $search);
return $this->fetch();
}