请问 VerificationCodesController 中发送短信的异常处理代码 为什么也修改了呢?
在整合图片验证码的代码进 VerificationCodesController 中时,为什么将发送短信的异常处理代码也修改了呢?谢谢。
原来是:
} catch (\Overtrue\EasySms\Exceptions\NoGatewayAvailableException $exception) {
$message = $exception->getException('yunpian')->getMessage();
return $this->response->errorInternal($message ?? '短信发送异常');
}
修改为:
} catch (\GuzzleHttp\Exception\ClientException $exception) {
$response = $exception->getResponse();
$result = json_decode($response->getBody()->getContents(), true);
return $this->response->errorInternal($result['msg'] ?? '短信发送异常');
}
推荐文章: