作者 jinglong
1 个管道 的构建 通过 耗费 5 秒

修改退换货撤销接口

@@ -293,7 +293,7 @@ class Common @@ -293,7 +293,7 @@ class Common
293 293
294 $arr['data'] = $res; 294 $arr['data'] = $res;
295 //总页数 295 //总页数
296 - $arr['total_page'] = Common::countSoft('goods',$where); 296 + $arr['total_page'] = self::countSoft('goods',$where);
297 if(empty($flag)){ 297 if(empty($flag)){
298 return $arr; 298 return $arr;
299 }else{ 299 }else{
@@ -513,7 +513,7 @@ class Orders extends Api @@ -513,7 +513,7 @@ class Orders extends Api
513 513
514 //查询订单 514 //查询订单
515 $status = $this->order_status; 515 $status = $this->order_status;
516 - $where = ['id'=>$order_id,'uid'=>$this->uid,'status'=>$status[5]];//待收货 516 + $where = ['id'=>$order_id,'uid'=>$this->uid,'status'=>['in',$status[5],$status[8]]];//待收货,已完成
517 $order = Common::findSoftWhereData('order',$where,'id'); 517 $order = Common::findSoftWhereData('order',$where,'id');
518 if($order){ 518 if($order){
519 $orderModel = new Order(); 519 $orderModel = new Order();
@@ -544,6 +544,7 @@ class Orders extends Api @@ -544,6 +544,7 @@ class Orders extends Api
544 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 544 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
545 * 545 *
546 * @ApiParams (name="order_id", type="inter", required=true, description="订单id") 546 * @ApiParams (name="order_id", type="inter", required=true, description="订单id")
  547 + * @ApiParams (name="cancel_flag", type="inter", required=true, description="记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)")
547 * 548 *
548 * @ApiReturn({ 549 * @ApiReturn({
549 "code": 1, 550 "code": 1,
@@ -555,10 +556,11 @@ class Orders extends Api @@ -555,10 +556,11 @@ class Orders extends Api
555 public function cancelApplyReturnGoods(){ 556 public function cancelApplyReturnGoods(){
556 if($this->request->isGet()){ 557 if($this->request->isGet()){
557 $order_id = $this->request->get('order_id'); 558 $order_id = $this->request->get('order_id');
  559 + $cancel_flag = $this->request->get('cancel_flag');
558 560
559 - $rule = config('verify.order_detail'); 561 + $rule = config('verify.return_flag');
560 $validate = new Validate($rule['rule'],$rule['msg']); 562 $validate = new Validate($rule['rule'],$rule['msg']);
561 - if (!$validate->check(['order_id'=>$order_id])) { 563 + if (!$validate->check(['order_id'=>$order_id,'cancel_flag'=>$cancel_flag])) {
562 $this->error($validate->getError()); 564 $this->error($validate->getError());
563 } 565 }
564 566
@@ -568,7 +570,14 @@ class Orders extends Api @@ -568,7 +570,14 @@ class Orders extends Api
568 $order = Common::findSoftWhereData('order',$where,'id'); 570 $order = Common::findSoftWhereData('order',$where,'id');
569 if($order){ 571 if($order){
570 $orderModel = new Order(); 572 $orderModel = new Order();
  573 + if($cancel_flag == 1){
571 $res = $orderModel->where($where)->update(['status'=>$status[5],'return_refund_flag'=>0,'return_reason'=>'']);//待收货 574 $res = $orderModel->where($where)->update(['status'=>$status[5],'return_refund_flag'=>0,'return_reason'=>'']);//待收货
  575 + }else if($cancel_flag == 2){
  576 + $res = $orderModel->where($where)->update(['status'=>$status[8],'return_refund_flag'=>0,'return_reason'=>'']);//已完成
  577 + }else{
  578 + $res = false;
  579 + }
  580 +
572 if($res){ 581 if($res){
573 $this->success('撤销成功'); 582 $this->success('撤销成功');
574 }else{ 583 }else{
@@ -322,4 +322,17 @@ return [ @@ -322,4 +322,17 @@ return [
322 'share_uid.number' => '分享人id必须为数字', 322 'share_uid.number' => '分享人id必须为数字',
323 ] 323 ]
324 ], 324 ],
  325 + //申请退换货撤销
  326 + 'return_flag' => [
  327 + 'rule' => [
  328 + 'order_id' => 'require|number',
  329 + 'cancel_flag' => 'require|number',
  330 + ],
  331 + 'msg' => [
  332 + 'order_id.require' => '订单id不能为空',
  333 + 'order_id.number' => '订单id必须为数字',
  334 + 'cancel_flag.require' => '撤销标识不能为空',
  335 + 'cancel_flag.number' => '撤销标识必须为数字',
  336 + ]
  337 + ],
325 ]; 338 ];
@@ -5333,6 +5333,12 @@ @@ -5333,6 +5333,12 @@
5333 <td></td> 5333 <td></td>
5334 <td>订单id</td> 5334 <td>订单id</td>
5335 </tr> 5335 </tr>
  5336 + <tr>
  5337 + <td>cancel_flag</td>
  5338 + <td>inter</td>
  5339 + <td></td>
  5340 + <td>记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)</td>
  5341 + </tr>
5336 </tbody> 5342 </tbody>
5337 </table> 5343 </table>
5338 </div> 5344 </div>
@@ -5367,6 +5373,10 @@ @@ -5367,6 +5373,10 @@
5367 <input type="inter" class="form-control input-sm" id="order_id" required placeholder="订单id" name="order_id"> 5373 <input type="inter" class="form-control input-sm" id="order_id" required placeholder="订单id" name="order_id">
5368 </div> 5374 </div>
5369 <div class="form-group"> 5375 <div class="form-group">
  5376 + <label class="control-label" for="cancel_flag">cancel_flag</label>
  5377 + <input type="inter" class="form-control input-sm" id="cancel_flag" required placeholder="记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)" name="cancel_flag">
  5378 + </div>
  5379 + <div class="form-group">
5370 <button type="submit" class="btn btn-success send" rel="33">提交</button> 5380 <button type="submit" class="btn btn-success send" rel="33">提交</button>
5371 <button type="reset" class="btn btn-info" rel="33">重置</button> 5381 <button type="reset" class="btn btn-info" rel="33">重置</button>
5372 </div> 5382 </div>
@@ -7490,7 +7500,7 @@ @@ -7490,7 +7500,7 @@
7490 7500
7491 <div class="row mt0 footer"> 7501 <div class="row mt0 footer">
7492 <div class="col-md-6" align="left"> 7502 <div class="col-md-6" align="left">
7493 - Generated on 2019-12-10 15:38:45 </div> 7503 + Generated on 2019-12-10 17:23:13 </div>
7494 <div class="col-md-6" align="right"> 7504 <div class="col-md-6" align="right">
7495 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> 7505 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
7496 </div> 7506 </div>