dever 6 years ago
parent
commit
a6c23ff0c3
3 changed files with 13 additions and 5 deletions
  1. 7 3
      lib/Aliyun.php
  2. 5 1
      lib/Base.php
  3. 1 1
      src/Api.php

+ 7 - 3
lib/Aliyun.php

@@ -14,11 +14,15 @@ class Aliyun
 		$send['PhoneNumbers'] = $param['mobile'];
 		$send['SignName'] = $param['sign'];
 		$send['TemplateCode'] = $param['skin'];
-		$send['TemplateParam'] = $param;
-
+		unset($param['mobile']);
+		unset($param['sign']);
+		unset($param['skin']);
 		if (isset($param['id'])) {
 			$send['OutId'] = $param['id'];
+			unset($param['id']);
 		}
+		$send['TemplateParam'] = $param;
+		
 
 		// *** 需用户填写部分结束, 以下代码若无必要无需更改 ***
 		if(!empty($send['TemplateParam']) && is_array($send['TemplateParam'])) {
@@ -36,7 +40,7 @@ class Aliyun
 			array_merge($send, array(
 				'RegionId' => 'cn-hangzhou',
 				'Action' => 'SendSms',
-				'Version' => date('Y-m-d'),
+				'Version' => '2017-05-25',
 			))
 		);
 

+ 5 - 1
lib/Base.php

@@ -27,7 +27,11 @@ class Base
     private function mobile($mobile)
     {
         # 验证手机号是否有效
-
+        $rule = Dever::rule('mobile');
+        $state = preg_match($rule, $mobile);
+        if (!$state) {
+            Dever::alert('手机号无效');
+        }
     }
 
     public function send($skin, $mobile, $param = array())

+ 1 - 1
src/Api.php

@@ -14,7 +14,7 @@ class Api extends Base
 		$mobile = Dever::input('mobile');
 		$param = array
 		(
-			'content' => '自定义的内容',
+			'order' => Dever::order(),
 		);
 		return Dever::load('sms/api')->send($skin, $mobile, $param);
     }