From 0fa4300e3e2a2fd1c5fae2f0728c1f3c057c5949 Mon Sep 17 00:00:00 2001 From: Rrrrrrray <28804884+Rrrrrrray@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:57:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Auigf=E6=96=87=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=97=B6=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/exportLog.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/genshin/model/exportLog.js b/plugins/genshin/model/exportLog.js index edf5e1d..70b05c8 100644 --- a/plugins/genshin/model/exportLog.js +++ b/plugins/genshin/model/exportLog.js @@ -19,7 +19,7 @@ export default class ExportLog extends base { this.path = this.e.isSr ? `./data/srJson/${this.e.user_id}/` : `./data/gachaJson/${this.e.user_id}/` - this.game = this.e.game || this.e.isSr ? 'sr' : 'gs' + this.game = this.e.game this.pool = (game = 'gs') => { let pool = { @@ -156,7 +156,12 @@ export default class ExportLog extends base { } getAllList() { - let uigf = JSON.parse(fs.readFileSync('./temp/uigf/genshin.json', 'utf8')) + let uigf = './temp/uigf/genshin.json' + try { + uigf = JSON.parse(fs.readFileSync(uigf, 'utf8')) + } catch (error) { + uigf = false + } let res = { list: [] } @@ -171,8 +176,7 @@ export default class ExportLog extends base { } res[v.type] = json for (let v of json) { - // item_id必要字段 - if (!v.item_id) { + if (!v.item_id && uigf) { v.item_id = String(uigf[v.name]) } if (!this.e.isSr) {