<?php

declare (strict_types=1);
namespace App\Job;

use Hyperf\AsyncQueue\Job;
use App\Service\ALiSmsService;
use Hyperf\Di\Annotation\Inject;
class ExampleJob extends Job
{
    use \Hyperf\Di\Aop\ProxyTrait;
    use \Hyperf\Di\Aop\PropertyHandlerTrait;
    /**
     * 任务执行失败后的重试次数，即最大执行次数为 $maxAttempts+1 次
     *
     * @var int
     */
    protected $maxAttempts = 2;
    public $params;
    /**
     * @Inject
     * @var ALiSmsService
     */
    protected $ALiSmsService;
    public function __construct($params)
    {
        $this->__handlePropertyHandler(__CLASS__);
        // 这里最好是普通数据，不要使用携带 IO 的对象，比如 PDO 对象
        $this->params = $params;
    }
    public function handle()
    {
        $data = $this->params;
        $smsSphone = $this->ALiSmsService->newQuery()->sendSms();
        var_dump($smsSphone);
    }
}