作者 董瑞恩
1 个管道 的构建 通过 耗费 1 秒

interface

@@ -305,6 +305,13 @@ class UsersController extends HomeBaseController{ @@ -305,6 +305,13 @@ class UsersController extends HomeBaseController{
305 public function refundDeposit(){ 305 public function refundDeposit(){
306 $users_id=$this->request->param('users_id'); 306 $users_id=$this->request->param('users_id');
307 $users=Db::name('users')->where('id',$users_id)->find(); 307 $users=Db::name('users')->where('id',$users_id)->find();
  308 + if ($users['is_deposit']==0){
  309 + $this->apiResponse(302,'用户未缴纳押金');
  310 + }
  311 + $order=Db::name('order')->where(['users_id'=>$users_id,'state'=>['in',[1,2]]])->find();
  312 + if (!empty($order)){
  313 + $this->apiResponse(303,'用户还有未支付订单');
  314 + }
308 $orderNo=$users['deposit_order_no'];//需要退款的订单 315 $orderNo=$users['deposit_order_no'];//需要退款的订单
309 $price=$users['deposit']; 316 $price=$users['deposit'];
310 Db::startTrans(); 317 Db::startTrans();
@@ -322,7 +329,7 @@ class UsersController extends HomeBaseController{ @@ -322,7 +329,7 @@ class UsersController extends HomeBaseController{
322 Db::commit(); 329 Db::commit();
323 }else{ 330 }else{
324 Db::rollback(); 331 Db::rollback();
325 - $this->apiResponse(301,'error:'.$result); 332 + $this->apiResponse(302,'error:'.$result);
326 } 333 }
327 $this->apiResponse(200,'success'); 334 $this->apiResponse(200,'success');
328 } 335 }