1***@qq.com
1***@qq.com
  • 发布:2020-10-15 09:35
  • 更新:2020-10-15 09:35
  • 阅读:730

云函数里调用阿里云发送短信服务失败

分类:HBuilderX

'use strict';
exports.main = async (event, context) => {
try {
const randomStr = '00000' + Math.floor(Math.random() * 1000000)
const code = randomStr.substring(randomStr.length - 6)
const res = await uniCloud.sendSms({
smsKey: 'xxxx',
smsSecret: 'xxx',
phone: event.mobile,
templateId: 'xxx',
data: {
name: 'DCloud',
code: "123456",
action: '注册',
expMinute: '30',
}
})
// 调用成功,请注意这时不代表发送成功
return res
} catch(err) {
// 调用失败
console.log(err.errCode)
console.log(err.errMsg)
return {
code: err.errCode
msg: err.errMsg
}
}
};

2020-10-15 09:35 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复