|
@@ -7,6 +7,7 @@ use app\common\model\Address;
|
|
use app\common\model\Appointment as appointmentModel;
|
|
use app\common\model\Appointment as appointmentModel;
|
|
use app\common\model\AppointmentApplication;
|
|
use app\common\model\AppointmentApplication;
|
|
use app\common\model\AppointmentTicket;
|
|
use app\common\model\AppointmentTicket;
|
|
|
|
+use think\Exception;
|
|
use time\DateHelper;
|
|
use time\DateHelper;
|
|
|
|
|
|
class Appointment extends Base
|
|
class Appointment extends Base
|
|
@@ -51,8 +52,12 @@ class Appointment extends Base
|
|
$address_id = $this->request->param('address_id');
|
|
$address_id = $this->request->param('address_id');
|
|
$daytime = $this->request->param('daytime', date('Y-m-d'));
|
|
$daytime = $this->request->param('daytime', date('Y-m-d'));
|
|
|
|
|
|
- //生成工作日号源
|
|
|
|
- \app\common\model\Appointment::createWeekTicketAll($daytime);
|
|
|
|
|
|
+ try {
|
|
|
|
+ //生成工作日号源
|
|
|
|
+ \app\common\model\Appointment::createWeekTicketAll($daytime);
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ $this->json_error($e->getMessage());
|
|
|
|
+ }
|
|
|
|
|
|
$ticketModel = new AppointmentTicket();
|
|
$ticketModel = new AppointmentTicket();
|
|
$tickets = $ticketModel->where('address_id', $address_id)->where('appointment_daytime', strtotime($daytime))->select();
|
|
$tickets = $ticketModel->where('address_id', $address_id)->where('appointment_daytime', strtotime($daytime))->select();
|
|
@@ -98,7 +103,7 @@ class Appointment extends Base
|
|
//标记预约状态
|
|
//标记预约状态
|
|
if (in_array($period, $ticketPeriods)) {
|
|
if (in_array($period, $ticketPeriods)) {
|
|
// $arr[] = ['period' => $period, 'status' => 1];
|
|
// $arr[] = ['period' => $period, 'status' => 1];
|
|
- continue;//排除
|
|
|
|
|
|
+ continue;//排除已被预约的
|
|
} else {
|
|
} else {
|
|
$arr[] = ['period' => $period, 'status' => 0];
|
|
$arr[] = ['period' => $period, 'status' => 0];
|
|
}
|
|
}
|
|
@@ -122,8 +127,12 @@ class Appointment extends Base
|
|
|
|
|
|
$daytime = $this->request->param('daytime', date('Y-m-d'));
|
|
$daytime = $this->request->param('daytime', date('Y-m-d'));
|
|
|
|
|
|
- //生成工作日号源
|
|
|
|
- \app\common\model\Appointment::createWeekTicketAll($daytime);
|
|
|
|
|
|
+ try {
|
|
|
|
+ //生成工作日号源
|
|
|
|
+ \app\common\model\Appointment::createWeekTicketAll($daytime);
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ $this->json_error($e->getMessage());
|
|
|
|
+ }
|
|
|
|
|
|
$addressIds = $ticketModel->where('appointment_daytime', strtotime($daytime))->distinct(true)->column('address_id');
|
|
$addressIds = $ticketModel->where('appointment_daytime', strtotime($daytime))->distinct(true)->column('address_id');
|
|
|
|
|