/**
* Info: 短信通知(第一步)
*/
function SMS_notification($post){
// 您的服务密码为${code},请妥善保管。订单尾号${orderid},预计${time}上门服务。小蚁到家${name},电话${phone}。小蚁到家竭诚为您服务!
// $orderid = input('orderid');
// $time = input('time');
// $name = input('name');
// $phone = input('phone');
$rand = rand(000001,999999);
// $mobile = trim(input('post.mobile'));
$mobile = trim($post['mobile']);
$con['rand'] = $rand;//短信验证码
// $con['tel'] = $mobile;
$con['tel'] = $post['mobile'];
//新增模板参数
$con['order_no'] = $post['order_no'];
$con['time'] = $post['time'];
$con['name'] = $post['name'];
$con['phone'] = $post['phone'];
$preg_phone='/^1[34578]\d{9}$/ims';
$rtn = [];
if(!$mobile)
{
$rtn['code'] = 1;
$rtn['message'] = '手机号为空';
}else{
if(preg_match($preg_phone,$mobile)){
require_once('../extend/alidy/demo/SendSms.php');
$alisms = Db::name('alisms')
->field('accesskeyid,accesskeysecret,signname,mobilelogin')
->find(1);
$sendSms = new \Aliyun\DySDKLite\Sms\SendSms();
$res = get_object_vars($sendSms -> sendSms_yzm($con,$alisms));
// dump($res);
if($res['Message'] == 'OK')
{
$rtn['code'] = 0;
$rtn['rand'] = $rand;
}
}else{
$rtn['code'] = 1;
$rtn['message'] = '手机号格式不正确';
}
}
return $rtn;
// page_result(0, "ok", array(
// 'rtn' => $rtn
// ));
}
05-08
4199
04-26
06-07
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交