douyan8070 2019-01-07 12:01
浏览 77

在一定(30秒)的时间后检查mysql数据库中的值后运行一个函数

I have made a on demand truck booking portal. The functionality are:

  1. Customer book a vehicle as per his choice.
  2. After entering proper details the booking is inserted in database.
  3. According to customers pickup location the notification to driver are send via firebase on android application within the radius of 3kms.

My problem

I want to send notification to drivers which are in 3kms of radius and wait for 30sec for driver to accept booking. If none of the driver within 3kms accept the booking after 30 secs, then again I want to send notification to drivers which are within 3kms and 5kms, and check if booking is accepted by driver after 30 secs. if none of the driver accepts booking than I will shoot SMS to customer that your booking is not accepted.

what should I use to provide the above functionality? I have search on internet and I have found about CRON JOB...which is based on particular time of the day. but I want to execute a function after every booking is inserted in database and check it..

  • 写回答

1条回答 默认 最新

  • dongxian3418 2019-01-07 12:07
    关注

    This situation is perfect for message queues. Whenever the event is triggered, you queue a message with a delay of 30 seconds, listen for the message, and act accordingly.

    Check out https://github.com/marsanla/Codeigniter-jobQueue for a CodeIgniter queue implementation.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分