AdapayShareToSelfJob.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 AdapayShareToSelfJob 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. $time = time();
  24. $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all();
  25. foreach($store_list as $store) {
  26. try {
  27. // 定时任务
  28. $event = new OrderEvent();
  29. $event->store_id = $store->id;
  30. $event->adapayShareToSelf();
  31. } catch(\Exception $e) {
  32. \Yii::error($e);
  33. \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine());
  34. }
  35. }
  36. debug_log(['executeAdapayShareToSelf--end', time() - $time], 'debug_task_execute.log');
  37. }
  38. }