mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 用户创建证书流水线没有购买套餐或者超限时提前报错
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Provide } from '@midwayjs/core';
|
||||
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
|
||||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||
import { logger } from '@certd/basic';
|
||||
import { BaseException, Result } from '@certd/lib-server';
|
||||
import { Result } from '@certd/lib-server';
|
||||
|
||||
@Provide()
|
||||
export class GlobalExceptionMiddleware implements IWebMiddleware {
|
||||
@@ -14,11 +14,7 @@ export class GlobalExceptionMiddleware implements IWebMiddleware {
|
||||
await next();
|
||||
logger.info('请求完成:', url, Date.now() - startTime + 'ms');
|
||||
} catch (err) {
|
||||
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err.message);
|
||||
if (!(err instanceof BaseException)) {
|
||||
logger.error(err);
|
||||
}
|
||||
|
||||
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err);
|
||||
ctx.status = 200;
|
||||
if (err.code == null || typeof err.code !== 'number') {
|
||||
err.code = 1;
|
||||
|
||||
@@ -30,6 +30,19 @@ export class QywxNotification extends BaseNotification {
|
||||
})
|
||||
mentionedList!: string[];
|
||||
|
||||
@NotificationInput({
|
||||
title: '提醒指定手机号成员',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
mode: 'tags',
|
||||
open: false,
|
||||
},
|
||||
required: false,
|
||||
helper: '填写成员手机号,@all 为提醒所有人',
|
||||
})
|
||||
mentionedMobileList!: string[];
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('webhook地址不能为空');
|
||||
@@ -47,10 +60,11 @@ export class QywxNotification extends BaseNotification {
|
||||
url: this.webhook,
|
||||
method: 'POST',
|
||||
data: {
|
||||
msgtype: 'markdown',
|
||||
markdown: {
|
||||
content: `# ${body.title}\n\n${body.content}\n\n[查看详情](${body.url})`,
|
||||
msgtype: 'text',
|
||||
text: {
|
||||
content: `· ${body.title}\n· ${body.content}\n· 查看详情: ${body.url}`,
|
||||
mentioned_list: this.mentionedList,
|
||||
mentioned_mobile_list: this.mentionedMobileList,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user