From 469f80b3d99f2621983718f56621cd546b1f5288 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Wed, 20 Nov 2019 18:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=94=A8=E6=88=B7=E9=80=80?= =?UTF-8?q?=E5=9B=9E=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/InsurerController.php | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php index b75f9a7..c5fd1d1 100644 --- a/frontend/controllers/InsurerController.php +++ b/frontend/controllers/InsurerController.php @@ -3729,16 +3729,20 @@ class InsurerController extends BaseController $order_info->return_time = time(); $order_info->gift_status = 0; // 车辆信息处理 - if ($order_info->car->op2_id > 0) { //续保 - $order_info->car->location = 4; + $car_info = $order_info->car; + if ($car_info->op2_id > 0) { //续保 + $car_info->location = 4; }else { - $order_info->car->location = 2; - $order_info->car->is_xubao = 0; + $car_info->location = 2; + $car_info->is_xubao = 0; } - $order_info->car->user_id = $order_info->user_id; +// $car_info->user_id = $order_info->user_id; $tran = OrderT::getDb()->beginTransaction(); try { + if(!$car_info->save()) { + throw new \Exception(print_r($car_info->getErrors(), true)); + } // 财务处理 CaiwuT::deleteAll(['order_id'=>$order_info->id]); OrderCaiwuT::deleteAll(['order_id'=>$order_info->id]); @@ -3747,17 +3751,21 @@ class InsurerController extends BaseController // 车辆信息 CarCT::deleteAll(['id' => $order_info->car_id]); // 检测车辆是否移库 - if($order_info->car->op2_id > 0 && $order_info->car->location != 4){ + if($car_info->op2_id > 0 && $car_info->location != 4){ $car_db_info = new CarDT(false); $car_db_info->id = $order_info->car_id; $car_db_info->user_id = $order_info->user_id; - $order_info->car->save(); + if(!$car_db_info->save()) { + throw new \Exception(print_r($car_db_info->getErrors(), true)); + } } if(!$order_info->car->op2_id && $order_info->car->location != 2){ $car_db_info = new CarBT(false); $car_db_info->id = $order_info->car_id; $car_db_info->user_id = $order_info->user_id; - $order_info->car->save(); + if(!$car_db_info->save()) { + throw new \Exception(print_r($car_db_info->getErrors(), true)); + } } // 礼品状态回退 @@ -3765,7 +3773,9 @@ class InsurerController extends BaseController OrderGiftT::updateAll(['gift_src' => ''], ['order_id' => $order_info->id]); $this->addLog($order_info->car_id,'超管退单,理由是:'.$return_remark,1); - $order_info->save(); + if(!$order_info->save()) { + throw new \Exception(print_r($order_info->getErrors(), true)); + } $tran->commit(); $result['success'] = true; $result['msg'] = '操作成功';