AutoComplete.php 744 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 2017/3/14
  6. * Time: 上午10:09
  7. */
  8. namespace app\frontend\modules\order\services;
  9. use app\common\models\Order;
  10. use app\frontend\modules\order\services\behavior\OrderReceive;
  11. class AutoComplete
  12. {
  13. //自动完成
  14. public static function autoComplete()
  15. {
  16. $orders = Order::waitReceive()->get();
  17. if ($orders) {
  18. self::query($orders);
  19. }
  20. }
  21. private static function query($orders)
  22. {
  23. foreach ($orders as $order)
  24. {
  25. $receive_class = new OrderReceive($order);
  26. if ($receive_class->receiveable()) {
  27. $receive_class->receive();
  28. }
  29. }
  30. }
  31. }