From 529880642f6cafcf768dcaa5b6442c132d95b885 Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 26 Aug 2022 17:34:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtypescript=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 8 +------- back/services/notify.ts | 4 ++-- back/services/schedule.ts | 3 +-- package.json | 1 + 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index 2e25881e..c114434a 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -325,16 +325,10 @@ export default class CronService { cp.on('exit', async (code, signal) => { this.logger.info( - `${command} pid: ${cp.pid} exit ${code} signal ${signal}`, + `任务 ${command} 进程id: ${cp.pid} 退出,退出码 ${code}`, ); - await CrontabModel.update( - { status: CrontabStatus.idle, pid: undefined }, - { where: { id } }, - ); - resolve(); }); cp.on('close', async (code) => { - this.logger.info(`${command} pid: ${cp.pid} closed ${code}`); await CrontabModel.update( { status: CrontabStatus.idle, pid: undefined }, { where: { id } }, diff --git a/back/services/notify.ts b/back/services/notify.ts index 282a69dd..fac042be 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -245,7 +245,7 @@ export default class NotificationService { const [corpid, corpsecret, touser, agentid, thumb_media_id = '1'] = weWorkAppKey.split(','); const url = `https://qyapi.weixin.qq.com/cgi-bin/gettoken`; - const { access_token } = await got + const tokenRes: any = await got .post(url, { timeout: this.timeout, retry: 0, @@ -296,7 +296,7 @@ export default class NotificationService { const res: any = await got .post( - `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${access_token}`, + `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${tokenRes.access_token}`, { timeout: this.timeout, retry: 0, diff --git a/back/services/schedule.ts b/back/services/schedule.ts index acfb9530..0703a7ee 100644 --- a/back/services/schedule.ts +++ b/back/services/schedule.ts @@ -79,13 +79,12 @@ export default class ScheduleService { cp.on('exit', async (code, signal) => { this.logger.info( - `${command} pid: ${cp.pid} exit ${code} signal ${signal}`, + `任务 ${command} 进程id: ${cp.pid} 退出,退出码 ${code}`, ); }); cp.on('close', async (code) => { const endTime = dayjs(); - this.logger.info(`${command} pid: ${cp.pid} closed ${code}`); await callbacks.onEnd?.( cp, endTime, diff --git a/package.json b/package.json index 5e476bd0..280ecf59 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,7 @@ "react-split-pane": "^0.1.92", "sockjs-client": "^1.6.0", "ts-node": "^10.6.0", + "tslib": "^2.4.0", "typescript": "^4.6.2", "umi": "^3.5.21", "umi-request": "^1.4.0",