diff --git a/src/EasySms.php b/src/EasySms.php index 6430111b334fbc22e754a2e10338c2b398fab5d0..efd0fac6c5ffddc32fb8ccf4ef4d7741dc94e891 100644 --- a/src/EasySms.php +++ b/src/EasySms.php @@ -76,6 +76,9 @@ class EasySms * @param array $gateways * * @return array + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + * @throws \Overtrue\EasySms\Exceptions\NoGatewayAvailableException */ public function send($to, $message, array $gateways = []) { @@ -88,6 +91,8 @@ class EasySms * @param string|null $name * * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ public function gateway($name = null) { @@ -158,7 +163,7 @@ class EasySms * * @return string * - * @throws if no default gateway configured + * @throws \RuntimeException if no default gateway configured */ public function getDefaultGateway() { @@ -199,6 +204,8 @@ class EasySms * @throws \InvalidArgumentException * * @return GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ protected function createGateway($name) { @@ -223,6 +230,8 @@ class EasySms * @param array $config * * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ protected function makeGateway($gateway, $config) { diff --git a/src/Gateways/QcloudGateway.php b/src/Gateways/QcloudGateway.php index 519f3fcebe39b0a76008eb0c9d55451c38581be0..8f13ae37ad2b736a3d17b6ddfdc846810f99c49b 100644 --- a/src/Gateways/QcloudGateway.php +++ b/src/Gateways/QcloudGateway.php @@ -66,7 +66,7 @@ class QcloudGateway extends Gateway 'ext' => '', ]; - $random = str_random(10); + $random = substr(uniqid(), -10); $params['sig'] = $this->generateSign($params, $random); diff --git a/src/Gateways/TwilioGateway.php b/src/Gateways/TwilioGateway.php index 2c83e423f61853bf588d115d64806a359981b2c4..98e245b4bc77b919ac79f41484898d3377fe4a96 100644 --- a/src/Gateways/TwilioGateway.php +++ b/src/Gateways/TwilioGateway.php @@ -11,11 +11,11 @@ namespace Overtrue\EasySms\Gateways; +use GuzzleHttp\Exception\ClientException; use Overtrue\EasySms\Contracts\MessageInterface; use Overtrue\EasySms\Exceptions\GatewayErrorException; use Overtrue\EasySms\Support\Config; use Overtrue\EasySms\Traits\HasHttpRequest; -use GuzzleHttp\Exception\ClientException; /** * Class TwilioGateway. diff --git a/tests/Gateways/QcloudGatewayTest.php b/tests/Gateways/QcloudGatewayTest.php index e4b484a596594df96fb9e293084a2d111bfc6629..ddde9ffffe409547362e831ca7c349de25d30831 100644 --- a/tests/Gateways/QcloudGatewayTest.php +++ b/tests/Gateways/QcloudGatewayTest.php @@ -21,7 +21,7 @@ class QcloudGatewayTest extends TestCase { public function testGetName() { - $this->assertSame('tencent', (new QcloudGateway([]))->getName()); + $this->assertSame('qcloud', (new QcloudGateway([]))->getName()); } public function testSend()