dongma7796 2019-06-30 20:07
浏览 44

确保两次没有选择任何值的最有效方法

First off, I am not entirely sure how to word this question so maybe this is a duplicate(?). If so, I haven't found the other one and sorry in advance.

I am working on an application where the user can select multiple resources within a certain time frame. Something like room and group.

When verifying this I need to be sure no group or room is selected twice within the same time frame.

I am a bit unsure as to how I can make sure nothing is selected twice within the same time frame and keeping the application snappy.

I am using PHP7 and MySQL

  • 写回答

1条回答 默认 最新

  • dou6577 2019-06-30 20:22
    关注

    If I am not wrong, you are talking of a feature requirement similar to a Ticket Booking system where no two users can buy the tickets for the same seat?

    If yes, then you need to follow a two-step registration/booking process.

    Step 1: When somebody selects a seat/room then temporarily mark it as unavailable in the temp database table. If a new user tries to select the same room the user will see Unavailable message and cannot select it.

    Step 2: The selected seat/room will be blocked for say 10 minutes until the booking is confirmed. If the first user fails to complete the booking process then the seat/room will be automatically made available again for everybody after 10 minutes. And, if the booking is confirmed then the seat/room will be permanently unavailable until cancelled by the user (if your system allows this functionality).

    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答