Skip to content

Commit

Permalink
6.1.107
Browse files Browse the repository at this point in the history
🐞 修正
一些問題
  • Loading branch information
yayacat committed May 15, 2024
1 parent 9a264a5 commit e8ee9f3
Showing 1 changed file with 47 additions and 11 deletions.
58 changes: 47 additions & 11 deletions TREM.Electron/js/earthquake.js
Original file line number Diff line number Diff line change
Expand Up @@ -2888,19 +2888,30 @@ async function fetchFiles() {
if (setting["Real-time.local"]) {
station_data = require(path.resolve(__dirname, "../station.json"));

if (!station_data)
if (Object.keys(station_data).length !== 0) {
station_v2_run(station_data);
} else {
station_data = await (await fetch(route.tremStation(1))).json();
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
}

log("Get Local Station File", 1, "Location", "fetchFiles");
dump({ level: 0, message: "Get Local Station File", origin: "Location" });
} else {
station_data = await (await fetch(route.tremStation(1))).json();
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
log("Get Station File", 1, "Location", "fetchFiles");
dump({ level: 0, message: "Get Station File", origin: "Location" });
}

PGAMain();
if (Object.keys(station_data).length !== 0)
PGAMain();
else
await fetchFilesbackup();
} catch (err) {
log(err, 3, "Location", "fetchFiles");
dump({ level: 2, message: err, origin: "Location" });
Expand All @@ -2918,19 +2929,30 @@ async function fetchFilesbackup() {
if (setting["Real-time.local"]) {
station_data = require(path.resolve(__dirname, "../station.json"));

if (!station_data)
if (Object.keys(station_data).length !== 0) {
station_v2_run(station_data);
} else {
station_data = await (await fetch(route.tremStation(1))).json();
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
}

log("Get Local Station File", 1, "Location", "fetchFiles");
dump({ level: 0, message: "Get Local Station File", origin: "Location" });
} else {
station_data = await (await fetch(route.tremStation(1))).json();
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
log("Get Station backup File", 1, "Location", "fetchFilesbackup");
dump({ level: 0, message: "Get Station backup File", origin: "Location" });
}

PGAMain();
if (Object.keys(station_data).length !== 0)
PGAMain();
else
await fetchFilesbackup0();
} catch (err) {
console.log(err);
log(err, 3, "Location", "fetchFilesbackup");
Expand All @@ -2947,17 +2969,31 @@ async function fetchFilesbackup0() {

if (setting["Real-time.local"]) {
station_data = require(path.resolve(__dirname, "../station.json"));
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0) {
station_v2_run(station_data);
} else {
station_data = await (await fetch(route.tremStation(1))).json();

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
}

log("Get Local Station File", 1, "Location", "fetchFiles");
dump({ level: 0, message: "Get Local Station File", origin: "Location" });
} else {
station_data = await (await fetch(route.tremStation(1))).json();
station_v2_run(station_data);

if (Object.keys(station_data).length !== 0)
station_v2_run(station_data);
log("Get Station backup File", 1, "Location", "fetchFilesbackup");
dump({ level: 0, message: "Get Station backup File", origin: "Location" });
}

PGAMain();
if (Object.keys(station_data).length !== 0)
PGAMain();
else
await fetchFiles();
} catch (err) {
console.log(err);
log(err, 3, "Location", "fetchFilesbackup");
Expand Down

0 comments on commit e8ee9f3

Please sign in to comment.