diff --git a/qlCreate.js b/qlCreate.js index d3c61cd..30abb84 100644 --- a/qlCreate.js +++ b/qlCreate.js @@ -191,7 +191,9 @@ class Ql { let iniPath = this.env.iniPath || `${abspath}/config` let crons = await this.getCrons() let data = {} - for (let i of crons.data) { + let cronData = crons.data || crons + let label = crons.data ? true : false + for (let i of cronData) { let command = i.command.match(/task\s*qitoqito_psyduck\/(\w+\.js)/) if (command) { let script = command[1] @@ -266,7 +268,10 @@ import {fileURLToPath, pathToFileURL} from 'url'; name: `PsyDuck_${title}`, schedule: crontab, command: `task qitoqito_psyduck/${filename}.js`, - labels: [`PsyDuck`] + // labels: label ? [`PsyDuck`] : '' + } + if (label) { + dicts[`${filename}.js`].labels = [`PsyDuck`] } } } catch (e) { @@ -328,7 +333,10 @@ import {fileURLToPath, pathToFileURL} from 'url'; name: `PsyDuck_${psyDuck.profile.title}`, schedule: crontab, command: `task qitoqito_psyduck/${script}`, - labels: [`PsyDuck`] + // labels: label ? [`PsyDuck`] : '' + } + if (label) { + dicts[script].labels = [`PsyDuck`] } } } diff --git a/util/panel.js b/util/panel.js index 9755d8a..769ccd8 100644 --- a/util/panel.js +++ b/util/panel.js @@ -32,7 +32,7 @@ export class Panel { async _qlTask() { let envs = await this.getEnvs(`${this.type}_cookie`.toUpperCase()) - if (envs.length) { + if (envs.length>0) { for (let i of envs) { let pin = this.func.userName(i.value) if (this.dict[pin]) { @@ -62,12 +62,10 @@ export class Panel { value: this.dict[i].cookie }) } - if (array.length) { + if (array.length>0) { let data = await this.addEnvs(array) if (data.code == 200) { - for (let pin in this.dict) { - this.func.msg(`新增: ${pin} 成功`) - } + this.func.msg(`新增: ${i} 成功`) } else { console.error('[Error] 添加账号失败');