Skip to content

Commit c803da6

Browse files
committed
修复异步问题
1 parent 15d2a30 commit c803da6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/PlayedGames.astro

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ const appidList = (await steamApi.playedGames()).filter(
2626
);
2727
let count = 1;
2828
for (const game of appidList) {
29-
console.log(`请求 ${game.appid} 中 ${count++}/${appidList.length}`);
29+
console.log(
30+
`steam列表:请求 ${game.appid} 中 ${count++}/${appidList.length}`
31+
);
3032
await delay(DELAY_MS);
3133
const gameDetail = await steamApi.appdetails(game.appid);
3234
playedGames.push({
@@ -49,9 +51,11 @@ orderGames.forEach(({ imgurl }) => {
4951
}
5052
});
5153
52-
orderGames.forEach(async (game) => {
53-
if (game.name === "Final Fantasy XIV") {
54-
game.playtime_forever = await myApi.getFfPlayTime();
54+
const ffptime = await myApi.getFfPlayTime();
55+
console.log("狒狒游戏时长:", ffptime);
56+
orderGames.forEach((g) => {
57+
if (g.name === "Final Fantasy XIV") {
58+
g.playtime_forever = ffptime;
5559
}
5660
});
5761

0 commit comments

Comments
 (0)