Skip to content

Commit

Permalink
Fixed date format with gmdate overtrue#186
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Apr 26, 2019
1 parent 66a8d7e commit ad4adc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions src/Gateways/AliyunGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/Gateways/BaiduGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ad4adc9

Please sign in to comment.