Files
cycle_api/app/Thrid/Sms/SmsBase.php
2024-02-26 00:41:25 +08:00

36 lines
789 B
PHP

<?php
namespace App\Thrid\Sms;
use GuzzleHttp\Exception\GuzzleException;
abstract class SmsBase implements SmsInterface
{
function sendSmsCode($phone, $code, $iSendType = self::SMS_SEND_TYPE_CHARACTER): bool
{
}
/**
* @throws GuzzleException
*/
function sendReq($path, $aData, $aHeaders = null): \Psr\Http\Message\ResponseInterface
{
$url = $this->getUrl() . $path;
$client = new \GuzzleHttp\Client();
if ($aHeaders) {
$aHeaders = [
'accept' => 'application/json',
'content-type' => 'application/x-www-form-urlencoded',
];
}
return $client->request('POST', $url, [
'headers' => $aHeaders,
'body' => $aData,
]);
}
}