master
cody 6 months ago
parent e85f273d82
commit e80af49a8f

@ -45,21 +45,36 @@ class SendAppoint implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
// 预约门禁 // 预约车牌(有成功的就不会再次预约)
$result = (new Appointment())->appointDoor($this->appointmentModel, $this->appointmentConfig); $carResult = Appointment::sendAppoinCar($this->appointmentModel);
if ($result) { // 预约会议室(有成功的就不会再次预约)
// 成功预约会议室 $meetResult = (new Appointment())->appointMeet($this->appointmentModel, $this->appointmentConfig);
$result = (new Appointment())->appointMeet($this->appointmentModel, $this->appointmentConfig); // 预约门禁(每个学员一定会预约门禁)
} $doorResult = (new Appointment())->appointDoor($this->appointmentModel, $this->appointmentConfig);
if ($result) { if ($doorResult) {
// 门禁会议预约成功,预约车牌 // 门禁预约成功
Appointment::sendAppoinCar($this->appointmentModel);
// 预约成功
$this->appointmentModel->status = 1; $this->appointmentModel->status = 1;
} else { } else {
// 预约失败 // 预约失败
$this->appointmentModel->status = 4; $this->appointmentModel->status = 4;
} }
$this->appointmentModel->save(); $this->appointmentModel->save();
// 预约门禁
// $result = (new Appointment())->appointDoor($this->appointmentModel, $this->appointmentConfig);
// if ($result) {
// // 成功预约会议室
// $result = (new Appointment())->appointMeet($this->appointmentModel, $this->appointmentConfig);
// }
// if ($result) {
// // 门禁会议预约成功,预约车牌
// Appointment::sendAppoinCar($this->appointmentModel);
// // 预约成功
// $this->appointmentModel->status = 1;
// } else {
// // 预约失败
// $this->appointmentModel->status = 4;
// }
// $this->appointmentModel->save();
} }
} }

@ -156,7 +156,14 @@ class Appointment extends SoftDeletesModel
$result = false; $result = false;
$meetRepository = new MeetRepository(); $meetRepository = new MeetRepository();
foreach ($appointmentConfig as $config) { foreach ($appointmentConfig as $config) {
if(empty($config->room)) continue; if (empty($config->room)) {
continue;
};
// 判断是否有预约成功记录,没有就重新预约
$thirdMeetLog = $appointmentModel->thirdAppointmentLogs()->where('remark', '会议室预约')->where('finally', 1)->first();
if ($thirdMeetLog) {
continue;
}
$result = $meetRepository->appointment($appointmentModel, $config, $out); $result = $meetRepository->appointment($appointmentModel, $config, $out);
} }
return $result; return $result;

Loading…
Cancel
Save