midway-tencent-cloud-sms
Advanced tools
Comparing version 0.1.0 to 0.2.0
import { ILifeCycle, IMidwayContainer } from "@midwayjs/core"; | ||
import { TencentCloudSmsConfig } from "./interface"; | ||
export declare class TencentCloudSmsConfiguration implements ILifeCycle { | ||
smsConfig: any; | ||
smsConfig: TencentCloudSmsConfig; | ||
onReady(applicationContext: IMidwayContainer): Promise<void>; | ||
} | ||
//# sourceMappingURL=configuration.d.ts.map |
@@ -18,3 +18,5 @@ "use strict"; | ||
async onReady(applicationContext) { | ||
console.log("TencentCloudSmsConfiguration:onReady", this.smsConfig); | ||
if (this.smsConfig.log) { | ||
console.log("TencentCloudSmsConfiguration:onReady", this.smsConfig); | ||
} | ||
const client = new sms_client_1.Client({ | ||
@@ -21,0 +23,0 @@ credential: { |
@@ -8,2 +8,3 @@ export interface TencentCloudSmsConfig { | ||
TemplateId: string; | ||
log?: boolean; | ||
} | ||
@@ -10,0 +11,0 @@ export interface ISendSmsParam { |
@@ -45,2 +45,5 @@ "use strict"; | ||
}; | ||
if (this.smsConfig.log) { | ||
console.log(`发送短信的参数:`, params); | ||
} | ||
return this.client.SendSms(params); | ||
@@ -47,0 +50,0 @@ } |
@@ -5,3 +5,3 @@ export * from './dist/index'; | ||
interface MidwayConfig { | ||
tencentCloudSms: { | ||
tencentCloudSms?: { | ||
secretId: string; | ||
@@ -13,4 +13,5 @@ secretKey: string; | ||
TemplateId:string; | ||
log?:boolean; | ||
}; | ||
} | ||
} |
{ | ||
"name": "midway-tencent-cloud-sms", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "midwayjs tencent cloud sms component", | ||
@@ -19,3 +19,6 @@ "main": "dist/index.js", | ||
"sms", | ||
"tencent-cloud" | ||
"tencent-cloud", | ||
"腾讯云", | ||
"短信服务", | ||
"middleware" | ||
], | ||
@@ -22,0 +25,0 @@ "author": "wflixu", |
@@ -1,4 +0,4 @@ | ||
# midway-tencent-cloud-sms midway 腾讯云短信组件 | ||
# midway 腾讯云短信组件 | ||
封装 tencentcloud-sdk-nodejs-sms 成组件,命名空间是 tencentCloudSms | ||
封装 tencentcloud-sdk-nodejs-sms 成组件,命名空间是 tencentCloudSms 。 | ||
@@ -26,2 +26,3 @@ # 使用 | ||
SignName: '', | ||
log:true, // 调试时设置为true,会打印出配置和请求参数 | ||
}, | ||
@@ -28,0 +29,0 @@ ``` |
13195
212
59