LevelJob.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\jobs\orderEvent;
  8. use yii\base\BaseObject;
  9. use yii\queue\JobInterface;
  10. use app\events\OrderEvent;
  11. use app\models\Store;
  12. use app\constants\OptionSetting;
  13. use app\models\Option;
  14. use app\modules\admin\models\jushuitan\JuShuiTanForm;
  15. class LevelJob extends BaseObject implements JobInterface
  16. {
  17. public $store_id;
  18. public $action;
  19. public $in_action;
  20. public $version;
  21. public $time;
  22. public function execute($queue)
  23. {
  24. $time = time();
  25. $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all();
  26. foreach($store_list as $store) {
  27. try {
  28. // 定时任务
  29. $event = new OrderEvent();
  30. $event->store_id = $store->id;
  31. $event->level();
  32. } catch(\Throwable $e) {
  33. // \Yii::error($e);
  34. \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine());
  35. }
  36. }
  37. debug_log(['executeLevel--end', time() - $time], 'debug_task_execute.log');
  38. }
  39. }