1 | <?php |
||
14 | class AlidayuAgent extends Agent |
||
15 | { |
||
16 | public function sendSms($to, $content, $tempId, array $data) |
||
20 | |||
21 | public function sendTemplateSms($to, $tempId, array $data) |
||
33 | |||
34 | public function voiceVerify($to, $code, $tempId, array $data) |
||
52 | |||
53 | protected function request(array $params) |
||
60 | |||
61 | protected function createParams(array $params) |
||
74 | |||
75 | protected function genSign($params) |
||
89 | |||
90 | protected function setResult($result, $callbackName) |
||
91 | { |
||
92 | if ($result['request']) { |
||
93 | $result = json_decode($result['response'], true); |
||
94 | if (isset($result[$callbackName]['result'])) { |
||
95 | $result = $result[$callbackName]['result']; |
||
96 | $this->result(Agent::SUCCESS, (bool) $result['success']); |
||
97 | $this->result(Agent::INFO, $result['msg']); |
||
98 | $this->result(Agent::CODE, $result['err_code']); |
||
99 | } elseif (isset($result['error_response'])) { |
||
100 | $error = $result['error_response']; |
||
101 | $this->result(Agent::INFO, json_encode($error)); |
||
102 | $this->result(Agent::CODE, 'code:' . $error['code'] . '|sub_code:' . $error['sub_code']); |
||
103 | } |
||
104 | } else { |
||
105 | $this->result(Agent::INFO, '请求失败'); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | protected function genResponseName($method) |
||
113 | |||
114 | public function sendContentSms($to, $content) |
||
117 | } |
||
118 |