From 87e791e8531b263fe0841aefe0bb8f6acb07d9d3 Mon Sep 17 00:00:00 2001 From: Jay Huang Date: Sun, 1 Sep 2024 22:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=9F=A5=E8=AF=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/AppointmentSearch.php | 64 ++++++------------- .../views/emails/account_recovery_email.php | 4 +- .../emails/appointment_deleted_email.php | 4 +- .../views/emails/appointment_saved_email.php | 4 +- application/views/errors/html/error_404.php | 2 +- application/views/errors/html/error_db.php | 2 +- .../views/errors/html/error_general.php | 2 +- .../views/layouts/home_search_layout.php | 28 +++++--- application/views/pages/installation.php | 2 +- .../js/http/customers_search_http_client.js | 45 +++++++++++++ 10 files changed, 89 insertions(+), 68 deletions(-) create mode 100755 assets/js/http/customers_search_http_client.js diff --git a/application/controllers/AppointmentSearch.php b/application/controllers/AppointmentSearch.php index 3fda4d63..6030b7e7 100644 --- a/application/controllers/AppointmentSearch.php +++ b/application/controllers/AppointmentSearch.php @@ -1,54 +1,28 @@ -load->model('users_model'); - $this->load->model('appointments_model'); + $this->load->model('Appointment_model'); } - /** - * Search appointments by phone number. - */ - public function search_by_phone(): void - { - try { - $phone_number = request('phone_number', ''); + public function search_by_phone() { + $this->security->get_csrf_hash(); // 获取CSRF Token + $phone_number = $this->input->post('phone_number'); - if (empty($phone_number)) { - json_response([ - 'success' => false, - 'message' => 'Phone number is required.' - ]); - return; - } + if (!$phone_number) { + echo json_encode(['success' => false, 'message' => 'Phone number is required']); + return; + } - // 查询ea_users表中id_roles为3的用户ID - $user = $this->users_model->get_user_by_phone($phone_number, 3); + $appointments = $this->Appointment_model->get_appointments_by_phone($phone_number); - if (!$user) { - json_response([ - 'success' => false, - 'message' => 'No user found with this phone number.' - ]); - return; - } - - // 用用户ID查询ea_appointments表中的记录 - $appointments = $this->appointments_model->get_appointments_by_user_id($user->id); - - json_response([ - 'success' => true, - 'appointments' => $appointments - ]); - } catch (Throwable $e) { - json_exception($e); + if ($appointments) { + echo json_encode(['success' => true, 'appointments' => $appointments]); + } else { + echo json_encode(['success' => false, 'message' => 'No appointments found']); } } -} \ No newline at end of file +} diff --git a/application/views/emails/account_recovery_email.php b/application/views/emails/account_recovery_email.php index 19fa48c2..bd6b5b5e 100755 --- a/application/views/emails/account_recovery_email.php +++ b/application/views/emails/account_recovery_email.php @@ -32,9 +32,7 @@ diff --git a/application/views/layouts/home_search_layout.php b/application/views/layouts/home_search_layout.php index 721ec1e5..3569ddbf 100755 --- a/application/views/layouts/home_search_layout.php +++ b/application/views/layouts/home_search_layout.php @@ -89,19 +89,21 @@ 'company_logo' => vars('company_logo'), ]); ?>
-

+

查询预约信息

- - + +
-

+

预约结果

    - + 未找到预约信息。
    + + vars('display_login_button')]); ?> @@ -145,19 +147,26 @@ + + +