From c01023311d8793c0b4090b997fcf0ccddb82e6dd Mon Sep 17 00:00:00 2001 From: overtrue Date: Tue, 11 Jul 2017 10:14:24 +0800 Subject: [PATCH] Bugfix. #35 --- README.md | 1 + src/Gateways/SendcloudGateway.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3b4f49..0e8e51d 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ $easySms->send(13188888888, $message); 'sendcloud' => [ 'sms_user' => '', 'sms_key' => '', + 'timestamp' => false, // 是否启用时间戳 ], ``` ### [百度云](https://cloud.baidu.com/) diff --git a/src/Gateways/SendcloudGateway.php b/src/Gateways/SendcloudGateway.php index a404d7e..138534b 100644 --- a/src/Gateways/SendcloudGateway.php +++ b/src/Gateways/SendcloudGateway.php @@ -45,9 +45,12 @@ public function send($to, MessageInterface $message, Config $config) 'templateId' => $message->getTemplate(), 'phone' => is_array($to) ? implode(',', $to) : $to, 'vars' => $this->formatTemplateVars($message->getData()), - 'timestamp' => time(), ]; + if ($config->get('timestamp', false)) { + $params['timestamp'] = time() * 1000; + } + $params['signature'] = $this->sign($params, $config->get('sms_key')); $result = $this->post(sprintf(self::ENDPOINT_TEMPLATE, 'send'), $params);