1 Star 0 Fork 0

Notadd / ts-addon-sms

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

notadd-addon-sms

中文文档

Features

  1. SMS plug-in management
  2. SMS template management
  3. SMS sending records management
  4. Send SMS validation code using Tencent cloud SMS service
  5. Verify validation code validity

Installation

# install
yarn add @notadd/addon-sms

Usage

// application.module.ts
import { SmsModule } from "@notadd/addon-sms";

@Module({
    imports: [
        ...
        SmsModule,
        ...
    ],
    ...
})
...

// your service
import { SmsComponent } from "@notadd/addon-sms";

@Injectable()
export class ExampleService {
    constructor(
        @Inject("SmsComponentToken") private readonly smsComponentProvider: SmsComponent,
    ) { }

    // SmsRequest example:(2 , { appId: "1234567890", templateId: 123456, templateParam: ["xxxxx", "xxxxx"], "mobile": ["13512345678"] })
    async sendSms(type: number, smsRequest: SmsRequest) {
        // Send SMS, type is the type of message can only pass 0 or 1, 0 is a notification message, 1 is a verification code message
        // reuturn { code: number, message: string }
        await this.smsComponentProvider(type, smsRequest);
    }

    async smsValidator(mobile: string, validationCode: number) {
        // Judgment verification code validity
        // if success it return void,else return { code: number, message: string }
        await this.smsComponentProvider.smsValidator(mobile, validationCode);
    }
}

Comments ( 0 )

Sign in for post a comment

About

Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
1
https://gitee.com/notadd/ts-addon-sms.git
git@gitee.com:notadd/ts-addon-sms.git
notadd
ts-addon-sms
ts-addon-sms
master

Search

152606 8668e384 1899542 133635 2cd7d36e 1899542