Presell.php 836 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\common\command;
  3. use app\adminapi\logic\marketing\PresellLogic;
  4. use app\common\enum\PresellEnum;
  5. use think\console\Command;
  6. use think\console\Input;
  7. use think\console\Output;
  8. use app\common\model\Presell as PresellModel;
  9. /**
  10. * @notes 预售活动相关
  11. * author lbzy
  12. * @datetime 2024-04-24 18:22:01
  13. * @class Presell
  14. * @package app\common\command
  15. */
  16. class Presell extends Command
  17. {
  18. protected function configure()
  19. {
  20. $this->setName('presell')->setDescription('预售活动相关');
  21. }
  22. protected function execute(Input $input, Output $output)
  23. {
  24. $lists = PresellModel::where('end_time', '<', time())->where('status', PresellEnum::STATUS_START)->cursor();
  25. foreach ($lists as $presell) {
  26. PresellLogic::end([ 'id' => $presell->id ]);
  27. }
  28. }
  29. }