midwayjs-cool-tencentcloud
v0.1.5
Published
基于tencentcloud-sdk-nodejs
Downloads
45
Readme
使用方法
安装 midwayjs-cool-tencentcloud
$ npm i midwayjs-cool-tencentcloud --save
引入
...
import * as tencentcloud from 'midwayjs-cool-tencentcloud';
@Configuration({
imports: [
orm,
cool,
//腾讯云
tencentcloud
],
})
...
配置
后台管理系统-插件管理-腾讯云插件-配置
调用(controller)
import { Get, Inject, Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { Sdk } from 'midwayjs-cool-tencentcloud';
@Provide()
@CoolController('/')
export class WelcomeController extends BaseController {
// 腾讯云
@Inject('tencentcloud:sdk')
tencent: Sdk;
@Get('/')
public async welcome() {
const params = {
SmsSdkAppid: "****",
Sign: "****",
PhoneNumberSet: [`+86158****8350`],
TemplateID: "****",
TemplateParamSet: ['1234'],
}
await this.tencent.smsClient.SendSms(params)
return this.ok()
}
}
同理
// ...
// 文字识别 模块
await this.tencent.ocrClient.IDCardOCR(params) // 身份证识别
// 人像识别 模块
await this.tencent.iaiClient.DetectFace(params) // 人像分析
// ...