2
我已經獲得了數組中的手機號碼。 現在我正在循環播放數字併發送短信。 我看到這個例子,我們需要將數字與「<」(例如,14156667777 14158889999)分開發送批量短信。但我不知道如何用數組來完成它。通過NodeJS中的plivo API發送批量Sms
var sendSMS = Promise.promisify(notifier.sendSMS);
var text = req.params.textmessage;
Doctor.getAllDoctorNumber(function(err, doc){
if(err)
res.sendStatus(500);
else
{
for(i=0;i<doc.length;i++)
{
sendSMS(doc[i], text)
}
}
你可以把所有的sendSMS承諾到一個數組中,並使用promise.all來解決所有這些是有用的在平行下。 [鏈接](http://bluebirdjs.com/docs/api/promise.all.html) –