Merge pull request #305 from Rrrrrrray/master

fix:uigf文件更新失败时跳过
This commit is contained in:
Ca(HCO₃)₂ 2023-11-03 21:25:14 +08:00 committed by GitHub
commit 669e331d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -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.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') => { this.pool = (game = 'gs') => {
let pool = { let pool = {
@ -156,7 +156,12 @@ export default class ExportLog extends base {
} }
getAllList() { 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 = { let res = {
list: [] list: []
} }
@ -171,8 +176,7 @@ export default class ExportLog extends base {
} }
res[v.type] = json res[v.type] = json
for (let v of json) { for (let v of json) {
// item_id必要字段 if (!v.item_id && uigf) {
if (!v.item_id) {
v.item_id = String(uigf[v.name]) v.item_id = String(uigf[v.name])
} }
if (!this.e.isSr) { if (!this.e.isSr) {