| @@ 13-25 (lines=13) @@ | ||
| 10 | */ |
|
| 11 | class SubMailAgent extends Agent implements TemplateSms, VoiceCode |
|
| 12 | { |
|
| 13 | public function sendTemplateSms($to, $tempId, array $data) |
|
| 14 | { |
|
| 15 | $url = 'https://api.mysubmail.com/message/xsend.json'; |
|
| 16 | $params = [ |
|
| 17 | 'appid' => $this->appid, |
|
| 18 | 'project' => $tempId, |
|
| 19 | 'to' => $to, |
|
| 20 | 'signature' => $this->signature, |
|
| 21 | 'vars' => json_encode($data), |
|
| 22 | ]; |
|
| 23 | $result = $this->curlPost($url, $params); |
|
| 24 | $this->setResult($result); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function sendVoiceCode($to, $code) |
|
| 28 | { |
|
| @@ 27-38 (lines=12) @@ | ||
| 24 | $this->setResult($result); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function sendVoiceCode($to, $code) |
|
| 28 | { |
|
| 29 | $url = 'https://api.mysubmail.com/voice/verify.json'; |
|
| 30 | $params = [ |
|
| 31 | 'appid' => $this->appid, |
|
| 32 | 'to' => $to, |
|
| 33 | 'code' => $code, |
|
| 34 | 'signature' => $this->signature, |
|
| 35 | ]; |
|
| 36 | $result = $this->curlPost($url, $params); |
|
| 37 | $this->setResult($result); |
|
| 38 | } |
|
| 39 | ||
| 40 | protected function setResult($result) |
|
| 41 | { |
|