From b6826662a0a7e1d1613029b5e672995573ca7fb8 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 19 Jun 2021 22:02:23 +0800 Subject: [PATCH] u --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index e72d476..d134fce 100644 --- a/index.js +++ b/index.js @@ -4,12 +4,12 @@ const RequestPromise = require('request-promise-native') // request-promise/-nat const NodeMailer = require('nodemailer') // 或者 const smtpTransporter=require('nodemailer').createTransport({host:'', port:25, auth:{user:'',pass:''}}) let smtpTransporter = null -let smsClient = null // 在调用时,才创建 smsClient,防止 wo.Config 还没有建立好。 +let smsClient = null // 在调用时,才创建 smsClient,防止 wo.envi 还没有建立好。 module.exports = { sendMail: async function (option) { // 或者如果smtp参数已经确定,就可以直接定义 sendMail: Bluebird.promisify(Smtp.sendMail).bind(Smtp) - smtpTransporter = smtpTransporter || NodeMailer.createTransport(wo.Config.SMTP) + smtpTransporter = smtpTransporter || NodeMailer.createTransport(wo.envi.SMTP) return await util.promisify(smtpTransporter.sendMail).call(smtpTransporter, option) }, sendSms: async function (phone, option) { @@ -29,10 +29,10 @@ module.exports = { var matches = phone.match(/\d+/g) var smsNumber, smsUrl if (matches[0] === '86') { - smsUrl = wo.Config.SMS.dxton.urlChina + smsUrl = wo.envi.SMS.dxton.urlChina smsNumber = matches[1] } else { - smsUrl = wo.Config.SMS.dxton.urlWorld // 国际短信不需要签名、模板,可发送任意内容。 + smsUrl = wo.envi.SMS.dxton.urlWorld // 国际短信不需要签名、模板,可发送任意内容。 smsNumber = matches[0] + matches[1] } // return Bluebird.promisify(Http.get)(smsUrl+'&mobile='+smsNumber+"&content="+encodeURIComponent(msg)); @@ -74,9 +74,9 @@ module.exports = { smsClient = smsClient || new (require('@alicloud/sms-sdk'))({ - // 在调用时,才创建 smsClient,防止 wo.Config 还没有建立好。 - accessKeyId: wo.Config.SMS.aliyun.accessKeyId, - secretAccessKey: wo.Config.SMS.aliyun.secretAccessKey, + // 在调用时,才创建 smsClient,防止 wo.envi 还没有建立好。 + accessKeyId: wo.envi.SMS.aliyun.accessKeyId, + secretAccessKey: wo.envi.SMS.aliyun.secretAccessKey, }) var matches = phone.match(/\d+/g)