作者 郭盛
1 个管道 的构建 通过 耗费 4 秒

修改订单列表分页功能

... ... @@ -137,6 +137,8 @@ class Order extends Api
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果为空或者为1是进行中 2是已完成3是售后)")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
... ... @@ -161,6 +163,8 @@ class Order extends Api
{
$user_id = $this->getUserId();
$type = $this->request->param('type');
$page = $this->request->param('page', 1, 'intval');
$pageNum = $this->request->param('pageNum', 10, 'intval');
if($type == '' || $type == 1){
$data = Db::name('order')
->alias('a')
... ... @@ -168,6 +172,7 @@ class Order extends Api
->where('a.user_id',$user_id)
->where('a.finish_status',1)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 2){
$data = Db::name('order')
... ... @@ -176,6 +181,7 @@ class Order extends Api
->where('a.finish_status',2)
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 3){
$data = Db::name('order')
... ... @@ -185,6 +191,7 @@ class Order extends Api
->where('a.is_complaint',['=',1],['=',3],'or')
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}else{
$this->error('类型有误');
... ... @@ -213,6 +220,8 @@ class Order extends Api
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果为空或者为1是进行中2待总结3是结算中4已完成5退款/投诉)")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="pageNum", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
... ... @@ -237,6 +246,8 @@ class Order extends Api
{
$user_id = $this->getUserId();
$type = $this->request->param('type');
$page = $this->request->param('page', 1, 'intval');
$pageNum = $this->request->param('pageNum', 10, 'intval');
if($type == '' || $type == 1){
//进行中
$data = Db::name('order')
... ... @@ -245,6 +256,7 @@ class Order extends Api
->where('a.user_id',$user_id)
->where('a.finish_status',1)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 2){
//待总结
... ... @@ -255,6 +267,7 @@ class Order extends Api
->where('a.is_summarize',2)
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 3){
//结算中
... ... @@ -266,6 +279,7 @@ class Order extends Api
->where('a.user_id',$user_id)
->where('a.order_status',2)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 4){
//已完成
... ... @@ -277,6 +291,7 @@ class Order extends Api
->where('a.order_status',1)
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}elseif ($type == 5 ){
//退款/投诉
... ... @@ -287,6 +302,7 @@ class Order extends Api
->where('a.is_complaint',['=',1],['=',3],'or')
->where('a.user_id',$user_id)
->field('a.*,b.name,b.thumbnail')
->page($page,$pageNum)
->select();
}else{
$this->error('类型有误');
... ...
... ... @@ -3159,6 +3159,18 @@
<td></td>
<td>类型(如果为空或者为1是进行中 2是已完成3是售后</td>
</tr>
<tr>
<td>page</td>
<td>inter</td>
<td></td>
<td>当前页(默认1</td>
</tr>
<tr>
<td>pageNum</td>
<td>inter</td>
<td></td>
<td>每页显示数据个数(默认10)</td>
</tr>
</tbody>
</table>
</div>
... ... @@ -3193,6 +3205,14 @@
<input type="int" class="form-control input-sm" id="type" placeholder="类型(如果为空或者为1是进行中 2是已完成3是售后" name="type">
</div>
<div class="form-group">
<label class="control-label" for="page">page</label>
<input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
</div>
<div class="form-group">
<label class="control-label" for="pageNum">pageNum</label>
<input type="inter" class="form-control input-sm" id="pageNum" placeholder="每页显示数据个数(默认10)" name="pageNum">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="21">提交</button>
<button type="reset" class="btn btn-info" rel="21">重置</button>
</div>
... ... @@ -3309,6 +3329,18 @@
<td></td>
<td>类型(如果为空或者为1是进行中2待总结3是结算中4已完成5退款/投诉</td>
</tr>
<tr>
<td>page</td>
<td>inter</td>
<td></td>
<td>当前页(默认1</td>
</tr>
<tr>
<td>pageNum</td>
<td>inter</td>
<td></td>
<td>每页显示数据个数(默认10)</td>
</tr>
</tbody>
</table>
</div>
... ... @@ -3343,6 +3375,14 @@
<input type="int" class="form-control input-sm" id="type" placeholder="类型(如果为空或者为1是进行中2待总结3是结算中4已完成5退款/投诉" name="type">
</div>
<div class="form-group">
<label class="control-label" for="page">page</label>
<input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
</div>
<div class="form-group">
<label class="control-label" for="pageNum">pageNum</label>
<input type="inter" class="form-control input-sm" id="pageNum" placeholder="每页显示数据个数(默认10)" name="pageNum">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="22">提交</button>
<button type="reset" class="btn btn-info" rel="22">重置</button>
</div>
... ... @@ -6534,7 +6574,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-01-17 14:30:24 </div>
Generated on 2020-01-17 15:19:02 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...