修改短信接口
parent
3559d91a32
commit
e4daff1be8
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Base\Tool;
|
||||
|
||||
class TaskClient
|
||||
{
|
||||
const SUCCESS = '0000';
|
||||
|
||||
protected $client;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->client = new Client([
|
||||
'base_uri' => C('TASK_URL'),
|
||||
'timeout' => 10.0,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function post($uri, $data)
|
||||
{
|
||||
$response = $this->client->post($uri, [
|
||||
'verify' => false,
|
||||
'form_params' => $data
|
||||
]);
|
||||
$result = (string)$response->getBody();
|
||||
return json_decode($result, true);
|
||||
}
|
||||
|
||||
public function sendSms($mobile, $type = 'common')
|
||||
{
|
||||
$result = $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]);
|
||||
}
|
||||
|
||||
public function checkSms($mobile, $code)
|
||||
{
|
||||
$result = $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue