isLinkValid()) { return false; } if (4 == $this->times) { return $this->sendToService(); } $this->sendLink(); Yii::$app->queue->delay($this->getDelay())->push(new SendLinkJob([ 'link' => $this->link, 'startAt' => $this->startAt, 'times' => ++$this->times, ])); } public function isLinkValid() { // ... return true; } public function sendLink() { // 发链接到客服端 } public function sendToService() { // 发到客服 } protected function getDelay() { switch ($this->times) { case 1 : return 180; /* 三分钟 */ case 2 : return 120; /* 两分钟 */ case 3 : return 120; // 两分钟 } } }