From 832ab578b37ec92016bb21ce8722957bf8ece5f2 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Mon, 2 Dec 2019 00:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/CarController.php | 3 +++ frontend/controllers/DatabaseController.php | 26 +++++++++++++-------- frontend/controllers/RenewalController.php | 6 ++--- frontend/views/appointment/add.php | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index f627c88..de84bc6 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -4555,6 +4555,9 @@ class CarController extends BaseController throw new Exception(print_r($invalid_info->getFirstErrors(),true)); } } + CarCT::deleteAll(['id'=>$car_info->id]); + CarBT::deleteAll(['id'=>$car_info->id]); + CarDT::deleteAll(['id'=>$car_info->id]); $this->addLog($car_info->id,'从业务员无效车辆信息',1); $result['success'] = true; diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index 033a88b..a34cc89 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -1321,6 +1321,14 @@ class DatabaseController extends BaseController $this->addLog($c_info->id,'从业务员:'.$c_info->user->getShowName().'回收数据',1); //删除预约 AppointmentT::deleteAll('user_id='.$c_info->user_id.' and car_id='.$c_info->id); + $orders = OrderT::find() + ->where('car_id='.$c_info->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } $car_info = $c_info->car; $car_info->user_id = 0; @@ -1933,16 +1941,6 @@ class DatabaseController extends BaseController throw new \Exception(print_r($order_row->getErrors(),true)); } - //添加保单操作员 - $order_user_info = new OrderUserT(); - $order_user_info->user_id = $user_id; - $order_user_info->order_id = $order_row->id; - $order_user_info->type_id = 1; - $order_user_info->status = 0; - if(!$order_user_info->save()) { - throw new \Exception(print_r($order_user_info->getErrors(),true)); - } - //添加预约 AppointmentT::deleteAll('car_id='.$d_info->id); $row = new AppointmentT(); @@ -2011,6 +2009,14 @@ class DatabaseController extends BaseController $this->addLog($d_info->id,'从业务员:'.$d_info->user->getShowName().'回收跟踪数据',1); //删除预约 AppointmentT::deleteAll('user_id='.$d_info->user_id.' and car_id='.$d_info->id); + $orders = OrderT::find() + ->where('car_id='.$d_info->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } $car_info = $d_info->car; $car_info->user_id = 0; diff --git a/frontend/controllers/RenewalController.php b/frontend/controllers/RenewalController.php index 1e08582..4dc174f 100644 --- a/frontend/controllers/RenewalController.php +++ b/frontend/controllers/RenewalController.php @@ -105,7 +105,7 @@ class RenewalController extends BaseController $query = AppointmentT::find() ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') - ->where('appointment_t.is_first=1 and car_t.location=2'); + ->where('appointment_t.is_first=1 and car_t.location=4'); if($username == '') { $user_ids = $this->getChildrenUserIDs(); @@ -187,7 +187,7 @@ class RenewalController extends BaseController $query = AppointmentT::find() ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') - ->where('appointment_t.is_first=0 and car_t.location=2') + ->where('appointment_t.is_first=0 and car_t.location=4') ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); $user_ids = $this->getChildrenUserIDs(); @@ -263,7 +263,7 @@ class RenewalController extends BaseController $query = AppointmentT::find() ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') - ->where('appointment_t.is_first=0 and car_t.location=2'); + ->where('appointment_t.is_first=0 and car_t.location=4'); if($username == '') { $user_ids = $this->getChildrenUserIDs(); diff --git a/frontend/views/appointment/add.php b/frontend/views/appointment/add.php index 5f94550..4b7052a 100644 --- a/frontend/views/appointment/add.php +++ b/frontend/views/appointment/add.php @@ -75,7 +75,7 @@ use \common\libs\MyLib; parent.refreshList(); layer_close(); } else { - parent.layer.msg(data.msg); + parent.layer.msg(obj.msg); } },'json'); }, function(){