首页 > 解决方案 > 在php中禁用提供的开始日期时间和结束日期时间的时隙

问题描述

我正在开发一个约会模块,用户可以在其中在线预订某些时间段。我被困在在特定的一天(或一周)内禁用可用的时间段。我知道所需时段的长度(例如 30 分钟)以及可预订时段的营业时间(例如上午 09:00 - 下午 06:00)。此外,我有一个 MySQL 表来存储已经存在的约会。与我的问题相关的列如下所示:

appo_time_slot_id          appo_time_slot        appo_date_slot     status
       1                   09:00 am - 09:30 am        04/10/2019         0
       2                   09:30 am - 10:00 am        04/10/2019         0 
       3                   09:00 am - 09:30 am        05/10/2019         0
       4                   09:30 am - 10:00 am        05/10/2019         0 

现在鉴于上述信息,我无法找到一个好的解决方案(在 MySQL 或 PHP 中)来禁用方法(我想在表中执行 status=1)。还有一个条件:时隙只能在给定的分钟内开始。IE。对于上面表格中的示例数据,可用的 30 分钟时间段将是:09:00、09:30、10:00、10:30、11:00、...、11:30、...、6: 00.

请注意,禁用表中的列,即状态= 1,它介​​于开始日期、结束日期、开始时间和结束时间之间。例如

appo_time_slot_id           appo_time_slot        appo_date_slot     status
       1                   09:00 am - 09:30 am        04/10/2019         1
       2                   09:30 am - 10:00 am        04/10/2019         1 
       3                   09:00 am - 09:30 am        05/10/2019         1
       4                   09:30 am - 10:00 am        05/10/2019         1 

您认为解决此问题的最佳方法是什么?

标签: phpmysqldatetimeslot

解决方案


推荐阅读