Merge remote-tracking branch 'origin/master'

master
zhaocheng 2 years ago
commit 8170279558
  1. 21
      extend/service/CarInfoHandle.php

@ -141,7 +141,7 @@ class CarInfoHandle
if (count($map_or2) > 0) { if (count($map_or2) > 0) {
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''], ['car_info_t.insurer2_date', '<>', '']], $map_or2); $map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''], ['car_info_t.insurer2_date', '<>', '']], $map_or2);
} }
$query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) { $query = CarInfoT::where(empty($where) ? 1:$where)->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0) { if (count($map_or1) > 0 && count($map_or2) > 0) {
$query->whereOr([$map_or1, $map_or2]); $query->whereOr([$map_or1, $map_or2]);
} }
@ -149,15 +149,16 @@ class CarInfoHandle
if ($data['export_type'] == 'repeat') { if ($data['export_type'] == 'repeat') {
if ($data['export_table'] == 'repeat_frame_t') { if ($data['export_table'] == 'repeat_frame_t') {
$query = RepeatFrameT::leftjoin('car_info_t', 'repeat_frame_t.car_frame_no = car_info_t.car_frame_no') $query = RepeatFrameT::leftjoin('car_info_t', 'repeat_frame_t.car_frame_no = car_info_t.car_frame_no')
->field('car_info_t.*')->order('car_info_t.register_date asc') ->field('car_info_t.*')->order('car_info_t.id asc')
->where('repeat_frame_t.source', $data['source_id']); ->where('repeat_frame_t.source', $data['source_id']);
} else if ($data['export_table'] == 'peer_phone_t') { } else if ($data['export_table'] == 'peer_phone_t') {
$query = $query->rightJoin('peer_phone_t', 'peer_phone_t.phone = car_info_t.car_phone') $query = $query->rightJoin('peer_phone_t', 'peer_phone_t.phone = car_info_t.car_phone')
->field('car_info_t.*')->order('car_info_t.car_phone asc') ->where('peer_phone_t.source', $data['source_id'])
->where([['peer_phone_t.source', '=', $data['source_id']],['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)$']]); ->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 { }else {
$query = $query->order('register_date asc'); $query = $query->order('car_info_t.id asc');
} }
$count = $query->count(); $count = $query->count();
$count = $count <= $data['export_limit'] || $data['export_limit'] == 0 ? $count : $data['export_limit']; $count = $count <= $data['export_limit'] || $data['export_limit'] == 0 ? $count : $data['export_limit'];
@ -652,8 +653,9 @@ class CarInfoHandle
} }
$limit -= 3000; $limit -= 3000;
$end = $info->pop(); $end = $info->pop();
$lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); $lastRegisterDate = is_array($end) ? $end['id'] : $end->getData('id');
$limit > 0 && ($info = $query->where('register_date', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); $query_1 = clone $query;
$limit > 0 && ($info = $query_1->where('car_info_t.id', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select());
} }
} }
} }
@ -707,8 +709,9 @@ class CarInfoHandle
} }
$limit -= 3000; $limit -= 3000;
$end = $info->pop(); $end = $info->pop();
$lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); $lastRegisterDate = is_array($end) ? $end['id'] : $end->getData('id');
$limit > 0 && ($info = $query->where('register_date', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); $query_1 = clone $query;
$limit > 0 && ($info = $query_1->where('car_info_t.id', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select());
} }
} }
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);

Loading…
Cancel
Save