1234567891011121314151617181920212223242526272829303132 |
- <?php
- declare(strict_types=1);
- namespace app\common\business;
- use AlibabaCloud\Client\Exception\ClientException;
- use app\common\lib\Num;
- use app\common\lib\sms\AliSms;
- class Sms
- {
- public static function sendCode(string $phoneNumber, int $len): bool
- {
-
- $code = Num::getCode($len);
- $sms = AliSms::sendCode($phoneNumber, $code);
- if ($sms) {
-
-
-
- cache(config('redis.code_pre') . $phoneNumber, $code, config('redis.expire'));
- }
- return true;
- }
- }
|