diff --git a/src/Gateways/AliyunGateway.php b/src/Gateways/AliyunGateway.php index 8b442bb..178dfe8 100644 --- a/src/Gateways/AliyunGateway.php +++ b/src/Gateways/AliyunGateway.php @@ -66,7 +66,7 @@ public function send(PhoneNumberInterface $to, MessageInterface $message, Config 'SignatureMethod' => self::ENDPOINT_SIGNATURE_METHOD, 'SignatureVersion' => self::ENDPOINT_SIGNATURE_VERSION, 'SignatureNonce' => uniqid(), - 'Timestamp' => $this->getTimestamp(), + 'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'), 'Action' => self::ENDPOINT_METHOD, 'Version' => self::ENDPOINT_VERSION, 'PhoneNumbers' => !\is_null($to->getIDDCode()) ? strval($to->getZeroPrefixedNumber()) : $to->getNumber(), @@ -101,17 +101,4 @@ protected function generateSign($params) return base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret.'&', true)); } - - /** - * @return false|string - */ - protected function getTimestamp() - { - $timezone = date_default_timezone_get(); - date_default_timezone_set('GMT'); - $timestamp = date('Y-m-d\TH:i:s\Z'); - date_default_timezone_set($timezone); - - return $timestamp; - } } diff --git a/src/Gateways/BaiduGateway.php b/src/Gateways/BaiduGateway.php index 0d34c72..cc23c41 100644 --- a/src/Gateways/BaiduGateway.php +++ b/src/Gateways/BaiduGateway.php @@ -56,7 +56,7 @@ public function send(PhoneNumberInterface $to, MessageInterface $message, Config 'contentVar' => $message->getData($this), ]; - $datetime = date('Y-m-d\TH:i:s\Z'); + $datetime = gmdate('Y-m-d\TH:i:s\Z'); $headers = [ 'host' => self::ENDPOINT_HOST,