Store.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: thinkphp <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\console\task;
  13. use think\facade\Cache;
  14. use think\facade\Event;
  15. use app\console\model\Store as StoreModel;
  16. /**
  17. * 商城定时任务
  18. * Class StoreTask
  19. * @package app\console\task
  20. */
  21. class Store extends Task
  22. {
  23. /**
  24. * 任务处理
  25. */
  26. public function handle()
  27. {
  28. // 遍历商城列表并执行定时任务
  29. $storeIds = StoreModel::getStoreIds();
  30. foreach ($storeIds as $storeId) {
  31. //echo $storeId . PHP_EOL;
  32. // 定时任务:商城订单
  33. Event::trigger('Order', ['storeId' => $storeId]);
  34. // 报名订单
  35. Event::trigger('Book', ['storeId' => $storeId]);
  36. // 定时任务:用户优惠券
  37. //Event::trigger('UserCoupon', ['storeId' => $storeId]);
  38. // 定时任务:会员等级
  39. //Event::trigger('UserGrade', ['storeId' => $storeId]);
  40. }
  41. }
  42. }