mirror of
http://124.126.16.154:8888/singularity/HyperfDevelopmentKit.git
synced 2026-01-15 00:35:08 +08:00
fix(utils.sms): 对空数组进行了验证和拦截
This commit is contained in:
@@ -46,7 +46,7 @@ class SmsService
|
||||
*
|
||||
* @param string $phone 接收短信的手机号码
|
||||
* @param string|null $templateCode 短信模板CODE
|
||||
* @param array $templateParam 短信模板变量对应的实际值
|
||||
* @param array|null $templateParam 短信模板变量对应的实际值(不支持空数组)
|
||||
* @param string|null $signName 短信签名名称
|
||||
*
|
||||
* @return bool
|
||||
@@ -55,9 +55,12 @@ class SmsService
|
||||
public function sendSmsCountryside(
|
||||
string $phone,
|
||||
?string $templateCode = null,
|
||||
array $templateParam = [],
|
||||
?array $templateParam = null,
|
||||
?string $signName = null,
|
||||
): bool {
|
||||
if (is_array($templateParam) && count($templateParam) <= 0) {
|
||||
throw new \UnexpectedValueException('不支持空数组,请用 null 代替或不传', CommonErrorCode::FORMATTER_ERROR);
|
||||
}
|
||||
$phone_number = strtr($phone, ['#' => '']);
|
||||
|
||||
$sendSmsRequest = new SendSmsRequest(
|
||||
|
||||
Reference in New Issue
Block a user