From e83e727f3e9d0c4d6eab4492446a82345f2f774b Mon Sep 17 00:00:00 2001 From: bbaban <3102509561@qq.com> Date: Sun, 27 Aug 2023 19:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/base.js | 9 +++------ plugins/genshin/model/ledger.js | 11 ++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plugins/genshin/model/base.js b/plugins/genshin/model/base.js index 012d175..c2b06d1 100644 --- a/plugins/genshin/model/base.js +++ b/plugins/genshin/model/base.js @@ -20,12 +20,8 @@ export default class base { * @param pluResPath 插件资源路径 */ get screenData() { - let files = fs.readdirSync(`${this._path}/plugins/genshin/resources/img/namecard`).filter(file => file.endsWith('.png')) - let headImg = _.sample(files) - if (this.e?.isSr) { - files = fs.readdirSync(`${this._path}/plugins/genshin/resources/StarRail/img/worldcard`).filter(file => file.endsWith('.png')) - headImg = _.sample(files) + let headImg = _.sample(fs.readdirSync(`${this._path}/plugins/genshin/resources/StarRail/img/worldcard`).filter(file => file.endsWith('.png'))) return { saveId: this.userId, cwd: this._path, @@ -36,7 +32,8 @@ export default class base { srtempFile: 'StarRail/' } } - + + let headImg = _.sample(fs.readdirSync(`${this._path}/plugins/genshin/resources/img/namecard`).filter(file => file.endsWith('.png'))) return { saveId: this.userId, cwd: this._path, diff --git a/plugins/genshin/model/ledger.js b/plugins/genshin/model/ledger.js index ff1fcf5..448aadb 100644 --- a/plugins/genshin/model/ledger.js +++ b/plugins/genshin/model/ledger.js @@ -120,7 +120,7 @@ export default class Ledger extends base { ledgerInfo.color = [] ledgerInfo.month_data.group_by.forEach((item) => { - if (this.e.isSr){ + if (this.e.isSr) { item.color = this.color[this.action[item.action]] item.action_name = item.action_name.slice(0, 4) } else { @@ -132,8 +132,9 @@ export default class Ledger extends base { ledgerInfo.group_by = JSON.stringify(ledgerInfo.month_data.group_by) ledgerInfo.color = JSON.stringify(ledgerInfo.color) - let files = fs.readdirSync('./plugins/genshin/resources/StarRail/img/role').filter(file => file.endsWith('.webp')) - let icon = lodash.sample(files) + let icon = '' + if(this.e.isSr) + icon = lodash.sample(fs.readdirSync(`${this._path}/plugins/genshin/resources/StarRail/img/role`).filter(file => file.endsWith('.webp'))) let week = [ '星期日', @@ -144,12 +145,12 @@ export default class Ledger extends base { '星期五', '星期六' ] - let srday = `${week[moment().day()]}` return { saveId: this.e.uid, uid: this.e.uid, - day, icon, srday, + day, icon, + srday: `${week[moment().day()]}`, nowDay: moment(new Date()).format('YYYY年MM月DD日'), ...ledgerInfo, ...this.screenData