// 发送短信
async sendingSms() {
const data = this.ctx.data
try {
// 短信额度
const balance = await this.db.collection("natural-resources")
.where({
type: "SMS"
})
.get(); // 统计符合条件的记录数量
const res = await uniCloud.sendSms({
appid: '__UNI__FA6***',
phone: data.phone,
templateId: '320***', // 请替换为自己申请的模板id
data: {
orderNo: data.orderNo,
}
})
console.log("res", res);
// if (balance.data[0].balance >= 10) {
// console.log("111111111");
// // if (res.errCode == 0) {
// // console.log("发送成功");
// // this.db.collection('natural-resources').where({
// // type: "SMS"
// // }).update({
// // 'balance': this.db.command.inc(-10) // 减少余额
// // })
// // }
// }
} catch (e) {
//TODO handle the exception
console.log("短信发送错误", e);
}
}
报错18:34:18.799 [本地调试]短信发送错误 uniCloud-aliyun/cloudfunctions/cloud-router/service/expressDelivery.js:354:11
18:34:18.799 [本地调试]TypeError: Cannot read properties of undefined (reading 'provider')
8***@qq.com (作者)
是的
2024-03-14 21:58
DCloud_uniCloud_WYQ
回复 8***@qq.com: “TypeError: Cannot read properties of undefined (reading 'provider')” 这个错误带着错误堆栈截图发出来看看
2024-03-15 13:09
8***@qq.com (作者)
回复 DCloud_uniCloud_WYQ: 你看看是不是这个
2024-03-15 16:04