data = $data; return $this; } //处理单个任务的最大时间 public function getTtr() { return 2; } //任务超时(超过getTtr配置的时间), 重复 加入队列 的次数 $attempt public function canRetry($attempt, $error) { return ($attempt < 3) && ($error); } //执行队列 public function execute($queue) { $data = $this->data; date_default_timezone_set('PRC'); Yii::$app->mailer->compose('layouts/login', [ 'dateTime' => date('Y-m-d H:i:s'), 'h2' => $data['name'], 'h3' => $data['id'], 'pushDate' => $data['pushDate'], 'code' => 0, 'msg' => 'OK' ]) ->setTo('123456789@qq.com') ->setSubject('发送用户请求信息') ->send(); } }