|
@@ -5,11 +5,13 @@
|
|
* Email: [email protected]
|
|
* Email: [email protected]
|
|
* Time: 2020/1/11 17:56
|
|
* Time: 2020/1/11 17:56
|
|
*/
|
|
*/
|
|
|
|
+
|
|
declare(strict_types=1);
|
|
declare(strict_types=1);
|
|
|
|
|
|
namespace app\common\business;
|
|
namespace app\common\business;
|
|
|
|
|
|
use AlibabaCloud\Client\Exception\ClientException;
|
|
use AlibabaCloud\Client\Exception\ClientException;
|
|
|
|
+use app\common\lib\ClassArr;
|
|
use app\common\lib\Num;
|
|
use app\common\lib\Num;
|
|
use app\common\lib\sms\AliSms;
|
|
use app\common\lib\sms\AliSms;
|
|
|
|
|
|
@@ -23,8 +25,13 @@ class Sms
|
|
// $sms = AliSms::sendCode($phoneNumber, $code);
|
|
// $sms = AliSms::sendCode($phoneNumber, $code);
|
|
|
|
|
|
// 工厂模式1
|
|
// 工厂模式1
|
|
- $type = ucfirst($type);
|
|
|
|
- $class = "app\common\lib\sms\{$type}Sms";
|
|
|
|
|
|
+ // $type = ucfirst($type);
|
|
|
|
+ // $class = "app\common\lib\sms\{$type}Sms";
|
|
|
|
+ // $sms = $class::sendCode($phoneNumber, $code);
|
|
|
|
+
|
|
|
|
+ // 工厂模式2
|
|
|
|
+ $classStats = ClassArr::smsClassStat();
|
|
|
|
+ $class = ClassArr::initClass($type, $classStats);
|
|
$sms = $class::sendCode($phoneNumber, $code);
|
|
$sms = $class::sendCode($phoneNumber, $code);
|
|
|
|
|
|
if ($sms) {
|
|
if ($sms) {
|