定时删除失效订单怎么办的

WBOY
Release: 2016-06-13 13:17:50
Original
1147 people have browsed it

定时删除失效订单怎么处理的?
我现在的做法是在你下订单的时候就已经写进了order表,然后同时会写入订单生产的时间。然后判断这个时间,加入30天后这个订单还是处于未付款状态的话,会自动将其删除。

这个是我目前现在的做法,至于删除订单的话我不清楚怎么去写这个定时删除,直接就写在了后台首页。每一次管理员登录进来的时候相当于执行的这个检查订单并且删除订单的功能。

可能我的做法比较另类,正常情况下的话,一般大家都是怎么做这种东西?

------解决方案--------------------
这依赖管理员每天都要登陆,另外还有几种做法供你参考
1)Mysql 5.1以后可以创建定时器
2) 专门写一个删除订单的php页面,在服务器端创建定时任务:php removeExpiredOrders.php
3) 专门写一个删除订单的php页面,在客户端创建定时任务:php -r readfile('http://xxxxxx/removeExpiredOrders.php');
4)用户在显示订单的时候,更新订单状态

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!