From eb2611fbd14b165bd07fa973b2484d14370959c9 Mon Sep 17 00:00:00 2001 From: zhaocheng <578322713@qq.com> Date: Wed, 29 Apr 2020 23:21:15 +0800 Subject: [PATCH] =?UTF-8?q?b=E5=BA=93=E4=B8=8B=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/DatabaseController.php | 30 +++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index f2f486d..ee0390d 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -501,10 +501,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_date'); - $insurer1_day = $request->post('insurer1_day'); - $insurer1_month1 = $request->post('insurer1_date1'); - $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'); $username = $request->post('username'); $status = $request->post('status'); $sort_key = $request->post('sort_key'); @@ -520,10 +520,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_date'); - $insurer1_day = $request->get('insurer1_day'); - $insurer1_month1 = $request->get('insurer1_date1'); - $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'); $username = $request->get('username'); $status = $request->get('status'); $sort_key = $request->get('sort_key'); @@ -559,6 +559,20 @@ class DatabaseController extends BaseController if($insurer1_end != '') { $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"'); } + 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_b_t.user_id=0'); }