setTemplate(function ($gateway) { if ($gateway->getName() == 'aliyun') { return $this->smsCode->getAliyunTemplate(); } })->setContent(function ($gateway) { return "您的验证码为: {$this->smsCode->code},该验证码5分钟内有效,请勿泄露于他人"; })->setData(function ($gateway) { return [ 'code' => $this->smsCode->code, ]; }); } }