Commit 5ca547ce by 冷斌

fix bug

parent 41f4cbf8
......@@ -533,6 +533,36 @@ class PassportAction extends CommonAction
}
}
public function send($mobile, $code)
{
$host = "https://smssend.shumaidata.com";
$path = "/sms/send";
$method = "POST";
$appcode = "9bd4667dea1846bd83ed1147e3926240";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "receive={$mobile}&tag={$code}&templateId=MF0B6B4038";
$url = $host . $path . "?" . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$result = curl_exec($curl);
$json = json_decode($result, true);
return (int)$json['code'] === 200;
}
/**
* 获取验证码
*/
......@@ -559,10 +589,11 @@ class PassportAction extends CommonAction
if ($res) {
$this->mzError('此手机号已被注册,请更换!');
}
// $rnum = rand(100000, 999900);
$rnum = 123456;
$rnum = rand(100000, 999900);
// $rnum = 123456;
// $sendres = SmsService::send($phone,$rnum);
$sendres = 1;
$sendres = $this->send($phone, $rnum);
// $sendres = 1;
if ($sendres) {
//将验证码存入session
$_SESSION['phoneverify'] = $rnum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment