@@ -267,7 +267,7 @@ |
||
| 267 | 267 | |
| 268 | 268 | $name = \ucfirst(\str_replace(['-', '_', ''], '', $name)); |
| 269 | 269 | |
| 270 | - return __NAMESPACE__."\\Gateways\\{$name}Gateway"; |
|
| 270 | + return __NAMESPACE__."\\Gateways\\{$name}gateway"; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | public const ENDPOINT_FORMAT = 'json'; |
| 37 | 37 | |
| 38 | - public const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 |
|
| 38 | + public const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 |
|
| 39 | 39 | |
| 40 | 40 | public const SUCCESS_CODE = 200; |
| 41 | 41 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'user-agent' => 'PHP EasySms Client', |
| 55 | 55 | ]; |
| 56 | 56 | |
| 57 | - $result = $this->request('get', self::getEndpointUri() . '?' . http_build_query($params), ['headers' => $headers]); |
|
| 57 | + $result = $this->request('get', self::getEndpointUri().'?'.http_build_query($params), ['headers' => $headers]); |
|
| 58 | 58 | if (is_string($result)) { |
| 59 | 59 | $result = json_decode(json_encode(simplexml_load_string($result)), true); |
| 60 | 60 | } |
@@ -68,6 +68,6 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public static function getEndpointUri() |
| 70 | 70 | { |
| 71 | - return 'https://' . static::ENDPOINT_HOST . static::ENDPOINT_URI; |
|
| 71 | + return 'https://'.static::ENDPOINT_HOST.static::ENDPOINT_URI; |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) |
| 33 | 33 | { |
| 34 | 34 | $data = $message->getData($this); |
| 35 | - $endpoint = self::ENDPOINT_HOST . '/sms/api/v1'; |
|
| 35 | + $endpoint = self::ENDPOINT_HOST.'/sms/api/v1'; |
|
| 36 | 36 | return $this->execute($endpoint, [ |
| 37 | - 'phoneNumber' => (string)$to, |
|
| 37 | + 'phoneNumber' => (string) $to, |
|
| 38 | 38 | 'templateCode' => $this->config->get('template_code'), |
| 39 | - 'templateParam' => '{"code":"' . $data['code'] . '"}', |
|
| 39 | + 'templateParam' => '{"code":"'.$data['code'].'"}', |
|
| 40 | 40 | 'signName' => $this->config->get('sign_name'), |
| 41 | 41 | 'action' => 'SendSms' |
| 42 | 42 | ]); |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function execute(string $url, array $data) |
| 52 | 52 | { |
| 53 | - $uuid = date('ymdHis', time()) . substr(microtime(), 2, 6) . sprintf('%03d', rand(0, 999)); |
|
| 54 | - $time = date('Ymd', time()) . 'T' . date('His') . 'Z'; |
|
| 53 | + $uuid = date('ymdHis', time()).substr(microtime(), 2, 6).sprintf('%03d', rand(0, 999)); |
|
| 54 | + $time = date('Ymd', time()).'T'.date('His').'Z'; |
|
| 55 | 55 | $timeDate = substr($time, 0, 8); |
| 56 | 56 | |
| 57 | 57 | $body = bin2hex(hash("sha256", json_encode($data), true)); |
| 58 | 58 | $query = ''; |
| 59 | - $strSignature = "ctyun-eop-request-id:" . $uuid . "\n" . "eop-date:" . $time . "\n" . "\n" . $query . "\n" . $body; |
|
| 59 | + $strSignature = "ctyun-eop-request-id:".$uuid."\n"."eop-date:".$time."\n"."\n".$query."\n".$body; |
|
| 60 | 60 | |
| 61 | 61 | $kTime = $this->sha256($time, $this->config->get('secret_key')); |
| 62 | 62 | $kAk = $this->sha256($this->config->get('access_key'), $kTime); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $signature = base64_encode($this->sha256(($strSignature), $kDate)); |
| 67 | 67 | $headers['Content-Type'] = 'application/json'; |
| 68 | 68 | $headers['ctyun-eop-request-id'] = $uuid; |
| 69 | - $headers['Eop-Authorization'] = $this->config->get('access_key') . ' Headers=ctyun-eop-request-id;' . 'eop-date Signature=' . $signature; |
|
| 69 | + $headers['Eop-Authorization'] = $this->config->get('access_key').' Headers=ctyun-eop-request-id;'.'eop-date Signature='.$signature; |
|
| 70 | 70 | $headers['eop-date'] = $time; |
| 71 | 71 | |
| 72 | 72 | $result = $this->postJson($url, $data, $headers); |