作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在一个预订网站上工作。我正在使用 PHP Baikal CalDav Server(对其进行了修改)。当通过 Mozilla Thunderbird 或 iCal 生成时,Baikal 生成的 ical 文件将 VCALENDAR(每个事件)文件作为 mysql 中的介质 blob 存储在单列中。此外,我在网站上的预订也存储为 VCALENDAR 文件。
如果我想检查房间是否可用,我必须获取与 room_id 匹配的每个 VCALENDAR 文件并从 VCALENDAR 中提取信息。不知道这个手术成本是不是太高了。我尝试从已使用且不重复使用的 VCALENDARS 中“清理”数据库。
I have to open the room_id opening hours VCALENDAR -> extract data with Sabre process
For Loop through Exception VCALENDAR -> extract data with Sabre process
For Loop through Baikal VCALENDAR -> extract data with Sabre process
For Loop through Bookings VCALENDAR -> extract data with Sabre process
-> Process All -> Return Result, if room is free in the given time.
他们是否有任何智能算法,可以在拥有 ics 文件(开放时间、异常(exception)情况、预订、贝加尔湖预订)时检查给定时间段内的房间可用性?
谢谢!
最佳答案
直接查询SabreDAV。它针对基于时间的查询进行了高度优化。如果您执行 calendar-query
REPORT HTTP 请求,并筛选开始时间和结束时间,它将仅返回与该时间范围重叠的事件。
您甚至可以要求它抓取该时间范围内的所有事件,并将其转换为 VFREEBUSY
报告,该报告基本上是一个简化的 VCALENDAR,其中准确列出了哪些时间段开放和未开放。
您可以在CalDAV specification中找到有关这些报告的更多信息。
关于PHP+CalDav+ICS 房间时隙算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20497200/
我是一名优秀的程序员,十分优秀!