短信error

This commit is contained in:
chaosBreaking
2019-10-02 13:35:06 +08:00
parent 9015ba7064
commit 9cf8795fa4

View File

@@ -41,7 +41,10 @@ module.exports = {
return async function (phone, option = {}) { // 通过option对象对外提供统一的调用参数格式 return async function (phone, option = {}) { // 通过option对象对外提供统一的调用参数格式
if (/^\+\d+-\d+$/.test(phone)) { if (/^\+\d+-\d+$/.test(phone)) {
if (option.msgParam && option.templateCode && option.signName) { if (option.msgParam && option.templateCode && option.signName) {
return await sendSmsAliyun(smsClient, phone, option.msgParam, option.templateCode, option.signName); return await sendSmsAliyun(smsClient, phone, option.msgParam, option.templateCode, option.signName).catch(err => {
const errmsg = '短信发送失败 ' + JSON.stringify(err);
mylog && mylog.error ? mylog.error(errmsg) : console.error(errmsg);
});
} }
} }
return null; // 手机号格式错误,或者 option.vendor 错误。 return null; // 手机号格式错误,或者 option.vendor 错误。