mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
chore:
This commit is contained in:
@@ -71,7 +71,7 @@ const development = {
|
||||
type: 'better-sqlite3',
|
||||
database: './data/db.sqlite',
|
||||
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
|
||||
logging: true,
|
||||
logging: false,
|
||||
|
||||
// 配置实体模型 或者 entities: '/entity',
|
||||
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
|
||||
|
||||
@@ -24,7 +24,6 @@ export class CodeService {
|
||||
/**
|
||||
*/
|
||||
async generateCaptcha(randomStr) {
|
||||
console.assert(randomStr < 10, 'randomStr 过长');
|
||||
const svgCaptcha = await import('svg-captcha');
|
||||
const c = svgCaptcha.create();
|
||||
//{data: '<svg.../svg>', text: 'abcd'}
|
||||
@@ -57,8 +56,12 @@ export class CodeService {
|
||||
/**
|
||||
*/
|
||||
async sendSmsCode(phoneCode = '86', mobile: string, randomStr: string) {
|
||||
console.assert(phoneCode != null && mobile != null, '手机号不能为空');
|
||||
console.assert(randomStr != null, 'randomStr不能为空');
|
||||
if (mobile != null) {
|
||||
throw new Error('手机号不能为空');
|
||||
}
|
||||
if (!randomStr) {
|
||||
throw new Error('randomStr不能为空');
|
||||
}
|
||||
|
||||
const sysSettings = await this.sysSettingsService.getPrivateSettings();
|
||||
if (!sysSettings.sms?.config?.accessId) {
|
||||
@@ -89,8 +92,12 @@ export class CodeService {
|
||||
/**
|
||||
*/
|
||||
async sendEmailCode(email: string, randomStr: string) {
|
||||
console.assert(!email, 'Email不能为空');
|
||||
console.assert(!randomStr, 'randomStr不能为空');
|
||||
if (!email) {
|
||||
throw new Error('Email不能为空');
|
||||
}
|
||||
if (!randomStr) {
|
||||
throw new Error('randomStr不能为空');
|
||||
}
|
||||
|
||||
const code = randomNumber(4);
|
||||
await this.emailService.send({
|
||||
|
||||
@@ -76,7 +76,7 @@ export class NotificationService extends BaseService<NotificationEntity> {
|
||||
},
|
||||
});
|
||||
if (!res) {
|
||||
throw new ValidateException('默认通知配置不存在');
|
||||
return null;
|
||||
}
|
||||
return this.buildNotificationInstanceConfig(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user