Ver código fonte

fixed wxbind sms code

stanley-king 9 anos atrás
pai
commit
fa6367a0d1
2 arquivos alterados com 11 adições e 11 exclusões
  1. 5 9
      core/framework/libraries/sms.php
  2. 6 2
      helper/sms_helper.php

+ 5 - 9
core/framework/libraries/sms.php

@@ -13,6 +13,7 @@ class Sms
 	const register_code = 1;
 	const resetpass_code = 2;
 	const getbonus_code = 3;
+	const getbind_code = 4;
 
     /*
      * 发送手机短信
@@ -22,18 +23,13 @@ class Sms
     public function send($mobile,$content) 
     {
 		$mobile_host_type=C('mobile_host_type');
-		if($mobile_host_type==1) 
-		{
+		if($mobile_host_type == 1) {
 			return $this->mysend_smsbao($mobile,$content);
 		}
-        
-		if($mobile_host_type==2)
-		{
+		elseif($mobile_host_type == 2) {
 			return $this->mysend_yunpian($mobile,$content);
 		}
-        
-        if($mobile_host_type==3)
-        {
+        elseif($mobile_host_type == 3) {
             return $this->mysend_yuntx($mobile,$content);
         }
     }
@@ -72,7 +68,7 @@ class Sms
         $time = $content['time'];
         $type = intval($content['type']);
 
-		static $templates = array(self::register_code => '59006',self::resetpass_code => '63477', self::getbonus_code => '63479');
+		static $templates = array(self::register_code => '59006',self::resetpass_code => '63477', self::getbonus_code => '63479',self::getbind_code => '59006');
 		if(!array_key_exists($type,$templates)) return -1;
 
         return $this->send_msg($mobile,$code,$templates[$type],$time);

+ 6 - 2
helper/sms_helper.php

@@ -13,7 +13,7 @@ class sms_helper
 
     static public function send($mobile,$type)
     {
-        static $types = array('register', 'resetpass', 'getbonus');
+        static $types = array('register', 'resetpass', 'getbonus','getwxbind');
         if (!in_array($type, $types)) {
             return array('code' => errcode::ErrParamter, 'msg' => "错误的类型参数: type={$type}");
         }
@@ -23,9 +23,13 @@ class sms_helper
         }
         elseif ($type == 'resetpass') { //重置密码需要在登录的状态下才可以执行。
             $itype = Sms::resetpass_code;
-        } elseif ($type == 'getbonus') {
+        }
+        elseif ($type == 'getbonus') {
             $itype = Sms::getbonus_code;
         }
+        elseif($type == 'getwxbind') {
+            $itype = Sms::getbind_code;
+        }
 
         $cur_time = time();
         if(isset($_SESSION['sms_code'][$itype]))