From aebf1ee5ea736de5b5eceec3ea6bb3aa4cc4c97b Mon Sep 17 00:00:00 2001 From: StaticReasons <827391398@qq.com> Date: Mon, 19 Aug 2024 17:34:03 +0800 Subject: [PATCH 1/4] feat(flutter-mainPage): icp --- .../lib/mainPage/main_page_end.dart | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/flutter_project/lib/mainPage/main_page_end.dart b/flutter_project/lib/mainPage/main_page_end.dart index 8f5e818..a56e7d8 100644 --- a/flutter_project/lib/mainPage/main_page_end.dart +++ b/flutter_project/lib/mainPage/main_page_end.dart @@ -157,11 +157,23 @@ class MainPageEnd extends StatelessWidget { left: 0, right: 0, bottom: 0.015 * height, - child: Text( - "非 MINECRAFT 官方产品服务。未经 MOJANG 或 MICROSOFT 批准,也不与 MOJANG 或 MICROSOFT 关联", - textAlign: TextAlign.center, - style: textStyles.zh_p.copyWith(color: RDColors.white.onBackground), - )), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "非 MINECRAFT 官方产品服务。未经 MOJANG 或 MICROSOFT 批准,也不与 MOJANG 或 MICROSOFT 关联", + textAlign: TextAlign.center, + style: textStyles.zh_p.copyWith(color: RDColors.white.onBackground), + ), + SizedBox(height: 8), // 添加一些间距 + Text( + "ICP备案号:XXXXXX", // 替换为实际的备案号 + textAlign: TextAlign.center, + style: textStyles.zh_p.copyWith(color: RDColors.white.onBackground), + ), + ], + ), + ), // Debug Reference Image // Positioned( From 6289d1a9415b2417a9d0e4bd35ae2ec7124df2e1 Mon Sep 17 00:00:00 2001 From: StaticReasons <827391398@qq.com> Date: Mon, 19 Aug 2024 18:18:10 +0800 Subject: [PATCH 2/4] fix(fluter): amend api address --- .../lib/contentPage/content_list.dart | 17 ++++++++++------- flutter_project/lib/main.dart | 11 +++++++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/flutter_project/lib/contentPage/content_list.dart b/flutter_project/lib/contentPage/content_list.dart index 201d16c..f1d12f2 100644 --- a/flutter_project/lib/contentPage/content_list.dart +++ b/flutter_project/lib/contentPage/content_list.dart @@ -32,6 +32,9 @@ class SilverContentList extends StatefulWidget { State createState() => _SilverContentListState(); } +const String _defaultApiHost = "api.redstonedaily.com"; +const String _apiBase = "/v1/"; + class _SilverContentListState extends State { static const double listPaddingMedium = 280; static const double listPaddingSmall = 0; @@ -44,17 +47,17 @@ class _SilverContentListState extends State { // 异步获取json字符串 Future fetchJson(BuildContext context) async { - // return DefaultAssetBundle.of(context).loadString("assets/demo.json"); + // fetch data from url api - const String apiHost = String.fromEnvironment('API_HOST', defaultValue: ''); - Uri uri = apiHost != '' - ? Uri.https(apiHost, '/api/daily', { + const String apiHost = String.fromEnvironment('API_HOST', defaultValue: _defaultApiHost); + const String apiDailyPath = "api/daily"; + + Uri uri = Uri.https(apiHost, _apiBase + apiDailyPath, { 'yy': widget.year, 'mm': widget.month, 'dd': widget.day, - }) - : Uri.parse('/api/daily?yy=${widget.year}&mm=${widget.month}&dd=${widget.day}'); - + }); + try { final response = await http.get(uri); if (response.statusCode == 200) { diff --git a/flutter_project/lib/main.dart b/flutter_project/lib/main.dart index 793045c..0084eef 100644 --- a/flutter_project/lib/main.dart +++ b/flutter_project/lib/main.dart @@ -18,6 +18,9 @@ void main() { runApp(MyApp()); } +const String _defaultApiHost = "api.redstonedaily.com"; +const String _apiBase = "/v1/"; + class IssuesListProvider extends ChangeNotifier { IssuesList? _issuesList; @@ -30,8 +33,12 @@ class IssuesListProvider extends ChangeNotifier { } Future _fetchData() async { - const String apiHost = String.fromEnvironment('API_HOST', defaultValue: ''); - Uri uri = apiHost != '' ? Uri.https(apiHost, '/api/list') : Uri.parse('/api/list'); + + const String apiHost = String.fromEnvironment('API_HOST', defaultValue: _defaultApiHost); + const String apiListPath = "api/list"; + + Uri uri = Uri.https(apiHost, _apiBase + apiListPath); + try { final response = await http.get(uri); if (response.statusCode == 200) { From a29b2f1d270116fb1d2c3b6304db311c6e072d5d Mon Sep 17 00:00:00 2001 From: StaticReasons <827391398@qq.com> Date: Mon, 19 Aug 2024 18:43:43 +0800 Subject: [PATCH 3/4] attempt --- flutter_project/lib/contentPage/content_list.dart | 2 +- flutter_project/lib/main.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter_project/lib/contentPage/content_list.dart b/flutter_project/lib/contentPage/content_list.dart index f1d12f2..d8b4453 100644 --- a/flutter_project/lib/contentPage/content_list.dart +++ b/flutter_project/lib/contentPage/content_list.dart @@ -32,7 +32,7 @@ class SilverContentList extends StatefulWidget { State createState() => _SilverContentListState(); } -const String _defaultApiHost = "api.redstonedaily.com"; +const String _defaultApiHost = "api.rsdaily.com"; const String _apiBase = "/v1/"; class _SilverContentListState extends State { diff --git a/flutter_project/lib/main.dart b/flutter_project/lib/main.dart index 0084eef..aaef543 100644 --- a/flutter_project/lib/main.dart +++ b/flutter_project/lib/main.dart @@ -18,7 +18,7 @@ void main() { runApp(MyApp()); } -const String _defaultApiHost = "api.redstonedaily.com"; +const String _defaultApiHost = "api.rsdaily.com"; const String _apiBase = "/v1/"; class IssuesListProvider extends ChangeNotifier { @@ -36,7 +36,7 @@ class IssuesListProvider extends ChangeNotifier { const String apiHost = String.fromEnvironment('API_HOST', defaultValue: _defaultApiHost); const String apiListPath = "api/list"; - + Uri uri = Uri.https(apiHost, _apiBase + apiListPath); try { From 7797a012f722f4c3c802391950bc9f1af69037d9 Mon Sep 17 00:00:00 2001 From: Static_Reasons <827391398@qq.com> Date: Mon, 19 Aug 2024 20:10:05 +0800 Subject: [PATCH 4/4] fix(ICP) --- .../lib/contentPage/content_list.dart | 8 ++--- .../lib/jsonobject/issues_list.dart | 33 +++++++++++-------- flutter_project/lib/main.dart | 7 ++-- .../lib/mainPage/main_page_end.dart | 9 ++--- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/flutter_project/lib/contentPage/content_list.dart b/flutter_project/lib/contentPage/content_list.dart index d8b4453..47fd29a 100644 --- a/flutter_project/lib/contentPage/content_list.dart +++ b/flutter_project/lib/contentPage/content_list.dart @@ -50,13 +50,9 @@ class _SilverContentListState extends State { // fetch data from url api const String apiHost = String.fromEnvironment('API_HOST', defaultValue: _defaultApiHost); - const String apiDailyPath = "api/daily"; + const String apiDailyPath = "daily/get"; - Uri uri = Uri.https(apiHost, _apiBase + apiDailyPath, { - 'yy': widget.year, - 'mm': widget.month, - 'dd': widget.day, - }); + Uri uri = Uri.https(apiHost, "$_apiBase$apiDailyPath/${widget.year}/${widget.month}/${widget.day}"); try { final response = await http.get(uri); diff --git a/flutter_project/lib/jsonobject/issues_list.dart b/flutter_project/lib/jsonobject/issues_list.dart index 7b04add..ae913fb 100644 --- a/flutter_project/lib/jsonobject/issues_list.dart +++ b/flutter_project/lib/jsonobject/issues_list.dart @@ -22,19 +22,26 @@ class IssuesList { late final dailyFlattened = memo0(() => daily.values.expand((e) => e.values).expand((e) => e.entries).toList()); factory IssuesList.fromJson(List> jsonObject) => IssuesList( - daily: (jsonObject.map((e) => MapEntry(DateFormat("yyyy-MM-dd").parse(e["date"]!), e["title"]! as String)).toList() - ..sort((a, b) => a.key.compareTo(b.key))) - .fold>>>( - SplayTreeMap(), - (SplayTreeMap>> map, MapEntry item) { - final year = item.key.year; - final month = item.key.month; - map.putIfAbsent(year, () => SplayTreeMap()); - map[year]!.putIfAbsent(month, () => SplayTreeMap()); - map[year]![month]!.putIfAbsent(item.key, () => item.value); - return map; - }, - ), + daily: ( + jsonObject.map( + (e) => MapEntry( + DateFormat("yyyy-MM-dd").parse(e["date"]!), + e["title"]! as String, + ), + ) + .toList() + ..sort((a, b) => a.key.compareTo(b.key))) + .fold>>>( + SplayTreeMap(), + (SplayTreeMap>> map, MapEntry item) { + final year = item.key.year; + final month = item.key.month; + map.putIfAbsent(year, () => SplayTreeMap()); + map[year]!.putIfAbsent(month, () => SplayTreeMap()); + map[year]![month]!.putIfAbsent(item.key, () => item.value); + return map; + }, + ), ); // Map>> toJsonObject() => daily.map>>( diff --git a/flutter_project/lib/main.dart b/flutter_project/lib/main.dart index aaef543..2094649 100644 --- a/flutter_project/lib/main.dart +++ b/flutter_project/lib/main.dart @@ -35,9 +35,12 @@ class IssuesListProvider extends ChangeNotifier { Future _fetchData() async { const String apiHost = String.fromEnvironment('API_HOST', defaultValue: _defaultApiHost); - const String apiListPath = "api/list"; + const String apiListPath = "daily/query"; - Uri uri = Uri.https(apiHost, _apiBase + apiListPath); + Uri uri = Uri.https(apiHost, _apiBase + apiListPath, { + 'start_date': '2024-05-01', + 'end_date': DateFormat("yyyy-MM-dd").format(DateTime.now()), + }); try { final response = await http.get(uri); diff --git a/flutter_project/lib/mainPage/main_page_end.dart b/flutter_project/lib/mainPage/main_page_end.dart index a56e7d8..35c982a 100644 --- a/flutter_project/lib/mainPage/main_page_end.dart +++ b/flutter_project/lib/mainPage/main_page_end.dart @@ -161,13 +161,8 @@ class MainPageEnd extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "非 MINECRAFT 官方产品服务。未经 MOJANG 或 MICROSOFT 批准,也不与 MOJANG 或 MICROSOFT 关联", - textAlign: TextAlign.center, - style: textStyles.zh_p.copyWith(color: RDColors.white.onBackground), - ), - SizedBox(height: 8), // 添加一些间距 - Text( - "ICP备案号:XXXXXX", // 替换为实际的备案号 + "非 MINECRAFT 官方产品服务。未经 MOJANG 或 MICROSOFT 批准,也不与 MOJANG 或 MICROSOFT 关联\n" + "ICP备案号:闽ICP备2024058720号-2", textAlign: TextAlign.center, style: textStyles.zh_p.copyWith(color: RDColors.white.onBackground), ),