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'), ]); ?>