| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 64 | public function send($message) |
||
| 65 | { |
||
| 66 | $url = 'https://oapi.dingtalk.com/robot/send?access_token='.$this->accessToken; |
||
| 67 | |||
| 68 | if ($this->secret) { |
||
| 69 | $timestamp = time().'000'; |
||
| 70 | $url .= sprintf( |
||
| 71 | '&sign=%s×tamp=%s', |
||
| 72 | urlencode(base64_encode(hash_hmac('sha256', $timestamp."\n".$this->secret, $this->secret, true))), $timestamp |
||
| 73 | ); |
||
| 74 | } |
||
| 75 | |||
| 76 | $response = $this->getHttpClient()->request( |
||
| 77 | 'POST', $url, ['json' => $message] |
||
| 78 | ); |
||
| 79 | |||
| 80 | return $this->castResponseToType($response); |
||
|
|
|||
| 81 | } |
||
| 83 |