修复 puppeteer.js 中的一些小问题

* 修改 screenshots 中的渲染模板错误
* this.browserMacKey 仅在 process.env.pm_id 存在时被设置
This commit is contained in:
ikuaki1009 2023-03-31 19:28:50 +00:00 committed by Gitee
parent 2e3a9f4987
commit d9a8b97955
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ class Puppeteer {
logger.mark('puppeteer Chromium 已连接启动的实例')
} else {
console.log('chromium', this.browser.wsEndpoint())
if (this.browserMacKey) {
if (process.env.pm_id && this.browserMacKey) {
//缓存一下实例30天
const expireTime = 60 * 60 * 24 * 30
await redis.set(this.browserMacKey, this.browser.wsEndpoint(), { EX: expireTime })
@ -257,7 +257,7 @@ class Puppeteer {
if (!this.browser) return false
const savePath = this.dealTpl(this.model, data)
const savePath = this.dealTpl(name, data)
if (!savePath) return false
const page = await this.browser.newPage()