duanguane1670 2011-05-12 13:51
浏览 17
已采纳

触发PHP处理

I ask a similar question yesterday but it all got confusing and I thought I would start again and try and explain it a bit better..

I am about to design an auction site, much the same as ebay... items start from 24,12,7,3,1 days and count down until they are finished..

Now its easy for the page that shows the item to know its finished via ajax/jquery BUT, i presume i would need to run some sort of scheduled script that checks when auctions have finished.

This script will need to convert the auction in the database to finished so that in the sellers profile they can see its finished and the buyer can pay.

The trouble is if a script runs every 5 minutes, it means it could take up to 5 minutes for the auction to appear as finished in the sellers profile area, which is naff.

Also the Buyer wouldn't be able to pay until its converted over...

However if I were to run a script every 30-60 seconds surely this will be too much load on the server as the script may run multiple times if it has many auctions to convert and it takes more than 30-60 seconds to run ??

  • 写回答

3条回答 默认 最新

  • douzaipou3327 2011-05-12 14:01
    关注

    I don't think that a scheduled script is the solution you are looking for. You could set the auction status when you display it to a user - being that on auctioner's profile, or in auctions list or anywhere else . This way, you are guaranteed that who sees the auction, is seeing it with the status from when the page was loaded. Anyway, having a scheduled script to update the status is recommended only when you have heavy business logic to be done when an auction expired

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?