php - 在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
您认为解决此问题的最佳方法是什么?
解决方案
推荐阅读
- java - 使用 Class 类 getMethod() 和反射根据参数类型找到正确的方法(可能向上转换)
- python - 在 parametrized.expand 中使用 setUp 定义的变量
- javascript - onclick 导致“未定义”
- c++ - 一个类的多个函数不存储以前的结果
- ruby - 如何在ruby中的2个参数之间拆分字符串
- google-sheets - Excel/Google 表格 - 如何简化数组公式,使其不会崩溃?
- c# - 转换协变泛型接口类型时出现错误 CS1503
- sharepoint - SharePoint 2013:缺少编辑再现按钮
- javascript - 使用 Express 和 EJS 从另一个 js 文件传递 JSON
- ios - 点击 CollectionVC 时将 API 数据传递给 TableVC