Skip to content

Commit

Permalink
优化摩杜云和融合云请求方式 (overtrue#298)
Browse files Browse the repository at this point in the history
* 新增摩杜云支持

* 添加测试用例

* 删除文件(修改大小写文件git不识别)

* 处理大小写导致网关查找失败

* 新增融合云(助通)支持

* 新增蜘蛛云支持

* 优化摩杜云和融合云请求方式

Co-authored-by: 安正超 <[email protected]>
  • Loading branch information
Fenguoz and overtrue authored Mar 17, 2021
1 parent 2e79d9e commit e83da74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
9 changes: 1 addition & 8 deletions src/Gateways/ModuyunGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,7 @@ public function send(PhoneNumberInterface $to, MessageInterface $message, Config
];
$params['sig'] = $this->generateSign($params, $urlParams['random']);

$result = $this->request('post', $this->getEndpointUrl($urlParams), [
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json'
],
'json' => $params,
]);

$result = $this->postJson($this->getEndpointUrl($urlParams), $params);
$result = is_string($result) ? json_decode($result, true) : $result;
if (0 != $result['result']) {
throw new GatewayErrorException($result['errmsg'], $result['result'], $result);
Expand Down
13 changes: 5 additions & 8 deletions src/Gateways/RongheyunGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@ public function send(PhoneNumberInterface $to, MessageInterface $message, Config
],
];

$result = $this->request('post', self::ENDPOINT_URL, [
'headers' => [
'Content-Type' => 'application/json; charset="UTF-8"',
],
'body' => $params,
]);

$result = is_string($result) ? json_decode($result, true) : $result;
$result = $this->postJson(
self::ENDPOINT_URL,
$params,
['Content-Type' => 'application/json; charset="UTF-8"']
);
if (200 != $result['code']) {
throw new GatewayErrorException($result['msg'], $result['code'], $result);
}
Expand Down

0 comments on commit e83da74

Please sign in to comment.