AutoPink.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\listener\activity;
  12. use app\services\activity\combination\StorePinkServices;
  13. use crmeb\utils\Cron;
  14. use crmeb\interfaces\ListenerInterface;
  15. use think\facade\Log;
  16. /**
  17. * 定时处理拼团状态
  18. * Class AutoPink
  19. * @package app\listener\order
  20. */
  21. class AutoPink extends Cron implements ListenerInterface
  22. {
  23. /**
  24. * @param $event
  25. */
  26. public function handle($event): void
  27. {
  28. //定时处理拼团状态
  29. $this->tick(1000 * 60, function () {
  30. try {
  31. /** @var StorePinkServices $storePinkServices */
  32. $storePinkServices = app()->make(StorePinkServices::class);
  33. $storePinkServices->useStatusPink();
  34. return true;
  35. } catch (\Throwable $e) {
  36. Log::error('拼团失败处理,失败原因:[' . class_basename($this) . ']' . $e->getMessage());
  37. }
  38. });
  39. }
  40. }