作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

短信验证码

... ... @@ -136,6 +136,20 @@ if(!function_exists('send_sms')){
}
}
if(!function_exists('send_sms2')) {
function send_sms2($data){
//todo 短信账号密码
require_once EXTEND_PATH . 'nsms/nsms2.php';
$url = "https://api.mix2.zthysms.com/v2/sendSms";
$username = 'gongpinda';
$password = 'Cxz307312';
$sendAPI = new \sendAPI($url, $username, $password);
$sendAPI->data = $data;/*初始化数据包*/
$return = $sendAPI->sendSMS('POST');
return $return;
}
}
if(!function_exists('get_order_sn')) {
/**
* 获取惟一订单号
... ...
... ... @@ -213,11 +213,10 @@ class User extends Frontend
$content = array(
'content' => "【工品达】您的验证码是:" . $code . ",请于10分钟内使用,如非本人操作,可忽略此消息。",//短信内容
'mobile' => $mobile,//手机号码
'productid' => '887361',//产品id
'xh' => ''//小号
'tKey' => time(),
);
$result2 = send_sms($content);
if (substr($result2, 0, strpos($result2, ',')) != "1") {
$result2 = json_decode(send_sms2($content),true);
if ($result2['code'] != 200) {
Db::rollback();
$this->error('发送失败');
}
... ... @@ -268,11 +267,10 @@ class User extends Frontend
$content = array(
'content' => "【工品达】您的验证码是:" . $code . ",请于10分钟内使用,如非本人操作,可忽略此消息。",//短信内容
'mobile' => $mobile,//手机号码
'productid' => '887361',//产品id
'xh' => ''//小号
'tKey' => time(),
);
$result2 = send_sms($content);
if (substr($result2, 0, strpos($result2, ',')) != "1") {
$result2 = json_decode(send_sms2($content),true);
if ($result2['code'] != 200) {
Db::rollback();
$this->error('发送失败');
}
... ...