修复三轮车发送合同回调

This commit is contained in:
unknown 2023-09-09 18:58:57 +08:00
parent f671f8c80d
commit 5ed3fa839e

View File

@ -426,22 +426,22 @@ class IndexController extends BaseApiController
}
$cars = json_decode($model['cars_info'], true);
$result = $model->where('id', $model['id'])->save($param);
if ($result && isset($param['status']) && $param['status'] == 3) {
$data = [];
foreach ($cars as $k => $v) {
$data[$k]['car_id'] = $v['id'];
$data[$k]['car_license'] = $v['license'];
$data[$k]['type'] = 0;
$data[$k]['status'] = 0;
$data[$k]['company_id'] = $model['company_b_id'];
$data[$k]['rent_time'] = 0;
$data[$k]['rent_company_id'] = 0;
$data[$k]['contract_id'] = $model['id'];
$data[$k]['create_time'] = strtotime($model['create_time']);
}
$vehicleRent = new VehicleRent();
$vehicleRent->saveAll($data);
}
// if ($result && isset($param['status']) && $param['status'] == 3) {
// $data = [];
// foreach ($cars as $k => $v) {
// $data[$k]['car_id'] = $v['id'];
// $data[$k]['car_license'] = $v['license'];
// $data[$k]['type'] = 0;
// $data[$k]['status'] = 0;
// $data[$k]['company_id'] = $model['company_b_id'];
// $data[$k]['rent_time'] = 0;
// $data[$k]['rent_company_id'] = 0;
// $data[$k]['contract_id'] = $model['id'];
// $data[$k]['create_time'] = strtotime($model['create_time']);
// }
// $vehicleRent = new VehicleRent();
// $vehicleRent->saveAll($data);
// }
//返回
return $result ? $this->success('更新成功') : $this->fail('更新失败');
}