Browse Source

增加多参数短信发送

stanley-king 8 years ago
parent
commit
d68564f8f2
1 changed files with 7 additions and 9 deletions
  1. 7 9
      core/framework/libraries/sms.php

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

@@ -34,9 +34,8 @@ class Sms
         }
     }
 
-    public function send_msg($mobile, $code, $type, $extime = '5')
+    private function send_msg($mobile, $datas, $type)
     {
-        Log::record("SMS send:{$mobile} {$code} {$type}", Log::DEBUG);
         $folder = 'yuntx';
         $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $folder)));
         if (!empty($plugin)) {
@@ -44,7 +43,7 @@ class Sms
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'CCPRestSDK.php');
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'SendSMS.php');
 
-            return sendSMS($mobile, array($code, $extime), $type);
+            return sendSMS($mobile, $datas, $type);
         } else {
             return -1;
         }
@@ -64,14 +63,15 @@ class Sms
      */
     private function mysend_yuntx($mobile, $content)
     {
-        $code = $content['code'];
-        $time = $content['time'];
         $type = intval($content['type']);
-
+        if(array_key_exists('type',$content)) {
+            unset($content['type']);
+        }
+        
         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);
+        return $this->send_msg($mobile, $content, $templates[$type]);
     }
 
     /*
@@ -186,6 +186,4 @@ class Sms
             return false;
         }
     }
-
-
 }