live_order.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * 任务计划 - 订单处理
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class live_orderControl {
  11. /**
  12. * 初始化对象
  13. */
  14. public function __construct(){
  15. register_shutdown_function(array($this,"shutdown"));
  16. }
  17. /**
  18. * 订单回收
  19. */
  20. public function orderdealOp(){
  21. $day = OFFLINE_ORDER_CANCEL_TIME;
  22. $time = $day*24*60*60;
  23. $model_live_order = Model('live_order');
  24. $list = $model_live_order->getList(array('state'=>1));//未支付状态
  25. if(!empty($list)){
  26. $model_live_groupbuy = Model('live_groupbuy');
  27. foreach($list as $key=>$val){
  28. if(($val['add_time']+$time)<time()){
  29. $model_live_order->updateLiveOrder(array('order_id'=>$val['order_id']),array('state'=>4));
  30. $condition_live_groupbuy = array();
  31. $condition_live_groupbuy['groupbuy_id'] = $val['item_id'];
  32. $params_live_groupbuy = array();
  33. $params_live_groupbuy['buyer_count'] = array('exp','buyer_count+'.$val['number']);
  34. $params_live_groupbuy['buyer_num'] = array('exp','buyer_num-'.$val['number']);
  35. $model_live_groupbuy->edit($condition_live_groupbuy,$params_live_groupbuy);
  36. }
  37. }
  38. }
  39. }
  40. /**
  41. * 执行完成提示信息
  42. *
  43. */
  44. public function shutdown(){
  45. exit("success at ".date('Y-m-d H:i:s',time())."\n");
  46. }
  47. }