29 lines
891 B
PHP
29 lines
891 B
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class AppointmentSearch extends CI_Controller {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->load->model('Appointment_model');
|
|
}
|
|
|
|
public function search_by_phone() {
|
|
$this->security->get_csrf_hash(); // 获取CSRF Token
|
|
$phone_number = $this->input->post('phone_number');
|
|
|
|
if (!$phone_number) {
|
|
echo json_encode(['success' => false, 'message' => 'Phone number is required']);
|
|
return;
|
|
}
|
|
|
|
$appointments = $this->Appointment_model->get_appointments_by_phone($phone_number);
|
|
|
|
if ($appointments) {
|
|
echo json_encode(['success' => true, 'appointments' => $appointments]);
|
|
} else {
|
|
echo json_encode(['success' => false, 'message' => 'No appointments found']);
|
|
}
|
|
}
|
|
}
|