|
|
|
@ -144,7 +144,15 @@ class CarInfoHandle |
|
|
|
|
if (count($map_or2) > 0) { |
|
|
|
|
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''], ['car_info_t.insurer2_date', '<>', '']], $map_or2); |
|
|
|
|
} |
|
|
|
|
$query = CarInfoT::where(empty($where) ? 1:$where)->where(function ($query) use ($map_or1, $map_or2) { |
|
|
|
|
if ($data['export_type'] == 'repeat_delete') |
|
|
|
|
$query = Db::table('repeat_data_t')->alias('car_info_t')->where(empty($where) ? 1:$where) |
|
|
|
|
->where(function ($query) use ($map_or1, $map_or2) { |
|
|
|
|
if (count($map_or1) > 0 && count($map_or2) > 0) { |
|
|
|
|
$query->whereOr([$map_or1, $map_or2]); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
else |
|
|
|
|
$query = CarInfoT::where(empty($where) ? 1:$where)->where(function ($query) use ($map_or1, $map_or2) { |
|
|
|
|
if (count($map_or1) > 0 && count($map_or2) > 0) { |
|
|
|
|
$query->whereOr([$map_or1, $map_or2]); |
|
|
|
|
} |
|
|
|
@ -160,7 +168,7 @@ class CarInfoHandle |
|
|
|
|
->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$') |
|
|
|
|
->field('car_info_t.*')->order('car_info_t.id asc'); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
}elseif ($data['export_type'] != 'repeat_delete') { |
|
|
|
|
$query = $query->order('car_info_t.id asc'); |
|
|
|
|
} |
|
|
|
|
$count = $query->count(); |
|
|
|
@ -701,7 +709,7 @@ class CarInfoHandle |
|
|
|
|
} |
|
|
|
|
if($export_limit != 0 && $export_type == 'success_bmc'){ |
|
|
|
|
CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]); |
|
|
|
|
} else if($export_limit != 0) { |
|
|
|
|
} else if($export_limit != 0 && $export_type == 'repeat_delete') { |
|
|
|
|
CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -719,7 +727,7 @@ class CarInfoHandle |
|
|
|
|
} |
|
|
|
|
if($export_limit != 0 && $export_type == 'success_bmc'){ |
|
|
|
|
CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]); |
|
|
|
|
} else if($export_limit != 0) { |
|
|
|
|
} else if($export_limit != 0 && $export_type == 'repeat_delete') { |
|
|
|
|
CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); |
|
|
|
|
} |
|
|
|
|
$limit -= 3000; |
|
|
|
@ -757,8 +765,8 @@ class CarInfoHandle |
|
|
|
|
$bhxFields = ['car_no', 'car_frame_no']; |
|
|
|
|
} |
|
|
|
|
$bmcFields = ['register_date', 'car_no', 'car_frame_no', 'engine_no', 'factory_model', 'car_year', 'displacement', 'car_man', 'car_number', 'car_phone', 'purchase_price', 'id_man', 'id_number', 'id_phone', 'insured_man', 'insured_number', 'insured_phone', 'company', 'insurer1_date', 'insurer2_date', 'insurer_type', 'linkman', 'linkphone', 'linkman', 'linkphone', 'linkman', 'linkphone']; |
|
|
|
|
$titles = in_array($export_type, ['bmc','failed_bmc','none_bmc']) ? $bmcTitles : ($export_type == 'repeat' ? $orgTitles : $bhxTitles); |
|
|
|
|
$fields = in_array($export_type, ['bmc','failed_bmc','none_bmc']) ? $bmcFields : ($export_type == 'repeat' ? $orgFields : $bhxFields); |
|
|
|
|
$titles = in_array($export_type, ['bmc','failed_bmc','none_bmc']) ? $bmcTitles : ($export_type == 'repeat' || $export_type == 'repeat_delete' ? $orgTitles : $bhxTitles); |
|
|
|
|
$fields = in_array($export_type, ['bmc','failed_bmc','none_bmc']) ? $bmcFields : ($export_type == 'repeat' || $export_type == 'repeat_delete' ? $orgFields : $bhxFields); |
|
|
|
|
return [$titles, $fields]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|