CronOrderClose.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. // +---------------------------------------------------------------------+
  3. // | NiuCloud | [ WE CAN DO IT JUST NiuCloud ]  |
  4. // +---------------------------------------------------------------------+
  5. // | Copy right 2019-2029 www.niucloud.com  |
  6. // +---------------------------------------------------------------------+
  7. // | Author | NiuCloud <niucloud@outlook.com>  |
  8. // +---------------------------------------------------------------------+
  9. // | Repository | https://github.com/niucloud/framework.git  |
  10. // +---------------------------------------------------------------------+
  11. declare (strict_types = 1);
  12. namespace app\event;
  13. use app\model\order\OrderCommon;
  14. /**
  15. * 订单自动关闭
  16. */
  17. class CronOrderClose
  18. {
  19. // 行为扩展的执行入口必须是run
  20. public function handle($data)
  21. {
  22. $order = new OrderCommon();
  23. $order_info_result = $order->getOrderInfo([["order_id", "=", $data["relate_id"]]], "order_status");
  24. if(!empty($order_info_result) && $order_info_result["data"]["order_status"] == 0){
  25. $result = $order->orderClose($data["relate_id"]);//订单自动关闭
  26. return $result;
  27. }
  28. }
  29. }