From 6cc9b12b81d184bb2df9dc68f93ca45c3d47d229 Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Sun, 08 Nov 2026 17:31:58 +0800
Subject: [PATCH] feat(server): 添加游戏目录公开浏览页并更新重启脚本提示
---
fluttergamebox/lib/api/api_service.dart | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/fluttergamebox/lib/api/api_service.dart b/fluttergamebox/lib/api/api_service.dart
index a5626ea..79cfcf6 100644
--- a/fluttergamebox/lib/api/api_service.dart
+++ b/fluttergamebox/lib/api/api_service.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:fluttergamebox/api/api_client.dart';
+import 'package:fluttergamebox/utils/util.dart' show parseGb;
class Game {
final int id;
@@ -89,6 +90,13 @@
}
String get platformLabel => platform == 'switch' ? 'Switch资源' : 'PC资源';
+
+ /// 下载所需磁盘空间(GB):优先"磁盘占用",未设置时回退"游戏大小"
+ double get requiredDiskGb {
+ final install = parseGb(installSize);
+ if (install > 0) return install;
+ return parseGb(size);
+ }
}
class GameFile {
@@ -118,6 +126,7 @@
final String cover;
final String description;
final String fileUrl;
+ final String launchExe;
Tool({
required this.id,
required this.name,
@@ -125,6 +134,7 @@
required this.cover,
required this.description,
required this.fileUrl,
+ this.launchExe = '',
});
factory Tool.fromJson(Map<String, dynamic> j) => Tool(
id: j['id'],
@@ -133,6 +143,7 @@
cover: j['cover'] ?? '',
description: j['description'] ?? '',
fileUrl: j['file_url'] ?? '',
+ launchExe: j['launch_exe'] ?? '',
);
}
@@ -190,6 +201,9 @@
return (res['data'] as List).map((e) => Tool.fromJson(e)).toList();
}
+ static Future<Map<String, dynamic>> toolDownloadInfo(int toolId) async =>
+ await ApiClient.get('/api/tools/$toolId/download');
+
static Future<String> announcements() async {
final res = await ApiClient.get('/api/announcements');
if (res['code'] != 0) return '';
--
Gitblit v1.10.0