发布网友 发布时间:2022-04-23 01:17
共2个回答
热心网友 时间:2022-04-20 09:01
参考如下实例代码:self.sendAliMessage=function(req,res){varparam={'Action':'SingleSendSms','SignName':'xxxx',//短信签名名称'TemplateCode':'SMS_1635xxxx','RecNum':'135096???',//手机号'ParamString':JSON.stringify({"code":"9527"}),//验证码模板里的变量'Version':'2016-09-27','Format':'JSON','AccessKeyId':ali_access_key_id,'SignatureMethod':'HMAC-SHA1','SignatureVersion':'1.0','SignatureNonce':randomstr(9),//随机数'Timestamp':newDate().toISOString(),};param.Signature=sign.signForAliMessage(param,ali_access_key_secret);varapi_url='/';request.post({url:api_url,headers:{'Content-Type':'application/x-www-form-urlencoded'},form:param},function(err,response,data){varresultdata=JSON.parse(data);if(!err&&data.Model){result=res.returnData(200);}else{result=res.returnData(113);}res.send(result);});}/*签名方法*/sign.signForAliMessage=function(src_sign,access_key_secret){varparam,qstring=[];varoa=Object.keys(src_sign).sort(),on={};for(vari=0;i
热心网友 时间:2022-04-20 10:19
你说呢...