From b49fb911eb938fe792b42a608c146b7f6e0f22db Mon Sep 17 00:00:00 2001 From: zhaocheng <578322713@qq.com> Date: Thu, 16 Apr 2020 17:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8B=E5=8F=91=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/DatabaseController.php | 116 ++++++++++---------- frontend/views/database/a-index.php | 6 +- frontend/views/database/b-index.php | 8 +- frontend/views/database/c-index.php | 8 +- frontend/views/database/d-index.php | 8 +- 5 files changed, 80 insertions(+), 66 deletions(-) diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index e093a65..f2f486d 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -61,10 +61,10 @@ class DatabaseController extends BaseController $register_end = $request->post('register_end'); $insurer1_begin = $request->post('insurer1_begin'); $insurer1_end = $request->post('insurer1_end'); - $insurer1_month = $request->post('insurer1_month'); - $insurer1_day = $request->post('insurer1_day'); - $insurer1_month1 = $request->post('insurer1_month1'); - $insurer1_day1 = $request->post('insurer1_day1'); + $insurer1_month = $request->post('insurer_month_begin'); + $insurer1_day = $request->post('insurer_day_begin'); + $insurer1_month1 = $request->post('insurer_month_end'); + $insurer1_day1 = $request->post('insurer_day_end'); $b_lib = $request->post('b_lib'); $c_lib = $request->post('c_lib'); $d_lib = $request->post('d_lib'); @@ -89,10 +89,10 @@ class DatabaseController extends BaseController $register_end = $request->get('register_end'); $insurer1_begin = $request->get('insurer1_begin'); $insurer1_end = $request->get('insurer1_end'); - $insurer1_month = $request->get('insurer1_month'); - $insurer1_day = $request->get('insurer1_day'); - $insurer1_month1 = $request->get('insurer1_month1'); - $insurer1_day1 = $request->get('insurer1_day1'); + $insurer1_month = $request->get('insurer_month_begin'); + $insurer1_day = $request->get('insurer_day_begin'); + $insurer1_month1 = $request->get('insurer_month_end'); + $insurer1_day1 = $request->get('insurer_day_end'); $b_lib = $request->get('b_lib'); $c_lib = $request->get('c_lib'); $d_lib = $request->get('d_lib'); @@ -186,17 +186,19 @@ class DatabaseController extends BaseController if($insurer1_end != '') { $query->andWhere('insurer1_date<="'.$insurer1_end.'"'); } - if($insurer1_month != '') { - $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); - } - if($insurer1_day != '') { - $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); + if($insurer1_month != '' && $insurer1_day == '') { + $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); + } else if ($insurer1_month == '' && $insurer1_day != '') { + $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); + } else if ($insurer1_month != '' && $insurer1_day != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") >= "' . substr('0' . $insurer1_month, -2) . '-' . substr('0' . $insurer1_day, -2) . '"'); } - if($insurer1_month1 != '') { - $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); - } - if($insurer1_day1 != '') { - $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); + if($insurer1_month1 != '' && $insurer1_day1 == '') { + $query = $query->andWhere('month(car_t.insurer1_date) <="'.$insurer1_month1.'"'); + } else if ($insurer1_month1 == '' && $insurer1_day1 != '') { + $query = $query->andWhere('day(car_t.insurer1_date) <="'.$insurer1_day1.'"'); + } else if ($insurer1_month1 != '' && $insurer1_day1 != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") <= "' . substr('0' . $insurer1_month1, -2) . '-' . substr('0' . $insurer1_day1, -2) . '"'); } if($clean_right != '') { $query->andWhere('car_t.clean_right="'.$clean_right.'"'); @@ -1051,10 +1053,10 @@ class DatabaseController extends BaseController $print_end = $request->post('print_end'); $insurer1_begin = $request->post('insurer1_begin'); $insurer1_end = $request->post('insurer1_end'); - $insurer1_month = $request->post('insurer1_month'); - $insurer1_day = $request->post('insurer1_day'); - $insurer1_month1 = $request->post('insurer1_month1'); - $insurer1_day1 = $request->post('insurer1_day1'); + $insurer1_month = $request->post('insurer_month_begin'); + $insurer1_day = $request->post('insurer_day_begin'); + $insurer1_month1 = $request->post('insurer_month_end'); + $insurer1_day1 = $request->post('insurer_day_end'); $status = $request->post('status'); $username = $request->post('username'); @@ -1072,10 +1074,10 @@ class DatabaseController extends BaseController $print_end = $request->get('print_end'); $insurer1_begin = $request->get('insurer1_begin'); $insurer1_end = $request->get('insurer1_end'); - $insurer1_month = $request->get('insurer1_month'); - $insurer1_day = $request->get('insurer1_day'); - $insurer1_month1 = $request->get('insurer1_month1'); - $insurer1_day1 = $request->get('insurer1_day1'); + $insurer1_month = $request->get('insurer_month_begin'); + $insurer1_day = $request->get('insurer_day_begin'); + $insurer1_month1 = $request->get('insurer_month_end'); + $insurer1_day1 = $request->get('insurer_day_end'); $status = $request->get('status'); $username = $request->get('username'); @@ -1110,17 +1112,19 @@ class DatabaseController extends BaseController if($insurer1_end != '') { $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"'); } - if($insurer1_month != '') { - $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); + if($insurer1_month != '' && $insurer1_day == '') { + $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); + } else if ($insurer1_month == '' && $insurer1_day != '') { + $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); + } else if ($insurer1_month != '' && $insurer1_day != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") >= "' . substr('0' . $insurer1_month, -2) . '-' . substr('0' . $insurer1_day, -2) . '"'); } - if($insurer1_day != '') { - $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); - } - if($insurer1_month1 != '') { - $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); - } - if($insurer1_day1 != '') { - $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); + if($insurer1_month1 != '' && $insurer1_day1 == '') { + $query = $query->andWhere('month(car_t.insurer1_date) <="'.$insurer1_month1.'"'); + } else if ($insurer1_month1 == '' && $insurer1_day1 != '') { + $query = $query->andWhere('day(car_t.insurer1_date) <="'.$insurer1_day1.'"'); + } else if ($insurer1_month1 != '' && $insurer1_day1 != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") <= "' . substr('0' . $insurer1_month1, -2) . '-' . substr('0' . $insurer1_day1, -2) . '"'); } if($status == 1) { @@ -1743,10 +1747,10 @@ class DatabaseController extends BaseController $car_no = $request->post('car_no'); $insurer1_begin = $request->post('insurer1_begin'); $insurer1_end = $request->post('insurer1_end'); - $insurer1_month = $request->post('insurer1_month'); - $insurer1_day = $request->post('insurer1_day'); - $insurer1_month1 = $request->post('insurer1_month1'); - $insurer1_day1 = $request->post('insurer1_day1'); + $insurer1_month = $request->post('insurer_month_begin'); + $insurer1_day = $request->post('insurer_day_begin'); + $insurer1_month1 = $request->post('insurer_month_end'); + $insurer1_day1 = $request->post('insurer_day_end'); $status = $request->post('status'); $username = $request->post('username'); $sort_key = $request->post('sort_key'); @@ -1761,10 +1765,10 @@ class DatabaseController extends BaseController $car_no = $request->get('car_no'); $insurer1_begin = $request->get('insurer1_begin'); $insurer1_end = $request->get('insurer1_end'); - $insurer1_month = $request->get('insurer1_month'); - $insurer1_day = $request->get('insurer1_day'); - $insurer1_month1 = $request->get('insurer1_month1'); - $insurer1_day1 = $request->get('insurer1_day1'); + $insurer1_month = $request->get('insurer_month_begin'); + $insurer1_day = $request->get('insurer_day_begin'); + $insurer1_month1 = $request->get('insurer_month_end'); + $insurer1_day1 = $request->get('insurer_day_end'); $status = $request->get('status'); $username = $request->get('username'); $sort_key = $request->get('sort_key'); @@ -1810,17 +1814,19 @@ class DatabaseController extends BaseController if($insurer1_end != '') { $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"'); } - if($insurer1_month != '') { - $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); - } - if($insurer1_day != '') { - $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); - } - if($insurer1_month1 != '') { - $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); - } - if($insurer1_day1 != '') { - $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); + if($insurer1_month != '' && $insurer1_day == '') { + $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); + } else if ($insurer1_month == '' && $insurer1_day != '') { + $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); + } else if ($insurer1_month != '' && $insurer1_day != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") >= "' . substr('0' . $insurer1_month, -2) . '-' . substr('0' . $insurer1_day, -2) . '"'); + } + if($insurer1_month1 != '' && $insurer1_day1 == '') { + $query = $query->andWhere('month(car_t.insurer1_date) <="'.$insurer1_month1.'"'); + } else if ($insurer1_month1 == '' && $insurer1_day1 != '') { + $query = $query->andWhere('day(car_t.insurer1_date) <="'.$insurer1_day1.'"'); + } else if ($insurer1_month1 != '' && $insurer1_day1 != '') { + $query = $query->andWhere('DATE_FORMAT(car_t.insurer1_date,"%m-%d") <= "' . substr('0' . $insurer1_month1, -2) . '-' . substr('0' . $insurer1_day1, -2) . '"'); } if($status == 1) { $query->andWhere('car_d_t.user_id=0'); diff --git a/frontend/views/database/a-index.php b/frontend/views/database/a-index.php index 5de14f1..81d3064 100644 --- a/frontend/views/database/a-index.php +++ b/frontend/views/database/a-index.php @@ -55,9 +55,11 @@ use \common\libs\MyLib;
- + 月 + - - + 月 +
diff --git a/frontend/views/database/b-index.php b/frontend/views/database/b-index.php index f522b2f..b38f27c 100644 --- a/frontend/views/database/b-index.php +++ b/frontend/views/database/b-index.php @@ -39,10 +39,12 @@ use \common\libs\MyLib;
-
- +
+ 月 + - - + 月 +
diff --git a/frontend/views/database/c-index.php b/frontend/views/database/c-index.php index 9852241..c55a794 100644 --- a/frontend/views/database/c-index.php +++ b/frontend/views/database/c-index.php @@ -39,10 +39,12 @@ use \common\libs\MyLib;
-
- +
+ 月 + - - + 月 +
diff --git a/frontend/views/database/d-index.php b/frontend/views/database/d-index.php index 4477994..0472fed 100644 --- a/frontend/views/database/d-index.php +++ b/frontend/views/database/d-index.php @@ -31,10 +31,12 @@ use \common\libs\MyLib;
-
- +
+ 月 + - - + 月 +