|
|
@ -6335,10 +6335,12 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$PHPReader = new \PHPExcel_Reader_Excel5(); |
|
|
|
$PHPReader = new \PHPExcel_Reader_Excel5(); |
|
|
|
if (!$PHPReader->canRead($filename)) { |
|
|
|
if (!$PHPReader->canRead($filename)) { |
|
|
|
$errorMessage = "Can not read file."; |
|
|
|
$errorMessage = "Can not read file."; |
|
|
|
echo $errorMessage; |
|
|
|
$result['msg'] = $errorMessage; |
|
|
|
return; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$tran = CarT::getDb()->beginTransaction(); |
|
|
|
|
|
|
|
try { |
|
|
|
$PHPExcel = $PHPReader->load($filename); |
|
|
|
$PHPExcel = $PHPReader->load($filename); |
|
|
|
$currentSheet = $PHPExcel->getSheet(0); |
|
|
|
$currentSheet = $PHPExcel->getSheet(0); |
|
|
|
|
|
|
|
|
|
|
@ -6435,8 +6437,7 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$car_info->phone = $car_man_phone; |
|
|
|
$car_info->phone = $car_man_phone; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!$car_info->save(false)) { |
|
|
|
if(!$car_info->save(false)) { |
|
|
|
var_dump($car_info->errors); |
|
|
|
throw new \Exception(print_r($car_info->getErrors(), true)); |
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$insert_total++; |
|
|
|
$insert_total++; |
|
|
@ -6493,14 +6494,20 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$car_info->phone = $car_man_phone; |
|
|
|
$car_info->phone = $car_man_phone; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!$car_info->save(false)) { |
|
|
|
if(!$car_info->save(false)) { |
|
|
|
var_dump($car_info->errors); |
|
|
|
throw new \Exception(print_r($car_info->getErrors(), true)); |
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
$insert_total++; |
|
|
|
$insert_total++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tran->commit(); |
|
|
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
|
|
$tran->rollBack(); |
|
|
|
|
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
$result['success'] = true; |
|
|
|
$result['msg'] = '操作成功'; |
|
|
|
$result['msg'] = '操作成功'; |
|
|
|
|
|
|
|
|
|
|
|