From d8f335eb4e0ab7c69a5c7585a0e20b68a7ee9716 Mon Sep 17 00:00:00 2001 From: userGyl Date: Thu, 15 Jan 2026 09:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ln_jq_app/android/app/build.gradle.kts | 34 +++++++++-- ln_jq_app/android/app/proguard-rules.pro | 61 +++++++++++++++++++ .../pages/b_page/reservation/controller.dart | 34 ++++++----- .../lib/pages/b_page/reservation/view.dart | 1 + .../lib/pages/c_page/mine/controller.dart | 4 +- ln_jq_app/lib/pages/c_page/mine/view.dart | 7 ++- .../pages/c_page/reservation/controller.dart | 4 +- 7 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 ln_jq_app/android/app/proguard-rules.pro diff --git a/ln_jq_app/android/app/build.gradle.kts b/ln_jq_app/android/app/build.gradle.kts index b2510f2..aab05d6 100644 --- a/ln_jq_app/android/app/build.gradle.kts +++ b/ln_jq_app/android/app/build.gradle.kts @@ -1,3 +1,6 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") id("kotlin-android") @@ -5,6 +8,14 @@ plugins { id("dev.flutter.flutter-gradle-plugin") } +val keystoreProperties = Properties() +val keystorePropertiesFile = rootProject.file("key.properties") +if (keystorePropertiesFile.exists()) { + keystorePropertiesFile.inputStream().use { input -> + keystoreProperties.load(input.reader(Charsets.UTF_8)) + } +} + android { namespace = "com.lnkj.ln_jq_app" compileSdk = flutter.compileSdkVersion @@ -30,11 +41,26 @@ android { versionName = "1.2.2" } + signingConfigs { + create("release") { + keyAlias = keystoreProperties["keyAlias"] as String? + keyPassword = keystoreProperties["keyPassword"] as String? + val storeFilePath = keystoreProperties["storeFile"] as String? + storeFile = if (storeFilePath != null) file(storeFilePath) else null + storePassword = keystoreProperties["storePassword"] as String? + } + } + buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + getByName("release") { + // 使用上面定义的 release 签名 + signingConfig = signingConfigs.getByName("release") + + // 修复混淆规则引用语法 + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } } } diff --git a/ln_jq_app/android/app/proguard-rules.pro b/ln_jq_app/android/app/proguard-rules.pro new file mode 100644 index 0000000..6e10484 --- /dev/null +++ b/ln_jq_app/android/app/proguard-rules.pro @@ -0,0 +1,61 @@ +# Please add these rules to your existing keep rules in order to suppress warnings. +# This is generated automatically by the Android Gradle plugin. + +# 忽略 Google Play Core 相关的缺失警告(解决你目前的报错) +-dontwarn com.google.android.play.core.** + + # Flutter 基础规则 +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } + + +-dontwarn com.huawei.android.os.BuildEx$VERSION +-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig$Builder +-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig +-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance$Builder +-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance +-dontwarn com.huawei.hianalytics.process.HiAnalyticsManager +-dontwarn com.huawei.hianalytics.util.HiAnalyticTools +-dontwarn com.huawei.hms.availableupdate.UpdateAdapterMgr +-dontwarn com.huawei.libcore.io.ExternalStorageFile +-dontwarn com.huawei.libcore.io.ExternalStorageFileInputStream +-dontwarn com.huawei.libcore.io.ExternalStorageFileOutputStream +-dontwarn com.huawei.libcore.io.ExternalStorageRandomAccessFile +-dontwarn org.android.netutil.PingEntry +-dontwarn org.android.netutil.PingResponse +-dontwarn org.android.netutil.PingTask +-dontwarn org.bouncycastle.crypto.BlockCipher +-dontwarn org.bouncycastle.crypto.engines.AESEngine +-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandom +-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandomBuilder + + +-keepclasseswithmembernames class ** { + native ; +} +-keepattributes Signature +-keep class sun.misc.Unsafe { *; } +-keep class com.taobao.** {*;} +-keep class com.alibaba.** {*;} +-keep class com.alipay.** {*;} +-keep class com.ut.** {*;} +-keep class com.ta.** {*;} +-keep class anet.**{*;} +-keep class anetwork.**{*;} +-keep class org.android.spdy.**{*;} +-keep class org.android.agoo.**{*;} +-keep class android.os.**{*;} +-keep class org.json.**{*;} +-dontwarn com.taobao.** +-dontwarn com.alibaba.** +-dontwarn com.alipay.** +-dontwarn anet.** +-dontwarn org.android.spdy.** +-dontwarn org.android.agoo.** +-dontwarn anetwork.** +-dontwarn com.ut.** +-dontwarn com.ta.** \ No newline at end of file diff --git a/ln_jq_app/lib/pages/b_page/reservation/controller.dart b/ln_jq_app/lib/pages/b_page/reservation/controller.dart index 9a3c6f6..edc87c7 100644 --- a/ln_jq_app/lib/pages/b_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/b_page/reservation/controller.dart @@ -65,11 +65,14 @@ class ReservationController extends GetxController with BaseControllerMixin { if (jobData != null) { final jobDataResult = BaseModel.fromJson(jobData.data); if (jobDataResult.code == 0) { - try{ - jobId = jobDataResult.data["id"] ?? ""; - String endTime = jobDataResult.data["endTime"] ?? ""; - String beginTime = jobDataResult.data["beginTime"] ?? ""; - String hydStatus = jobDataResult.data["hydStatus"] ?? ""; + try { + final List dataList = jobDataResult.data is List ? jobDataResult.data : []; + final firstJob = dataList[0]; + + jobId = firstJob["id"] ?? ""; + String endTime = firstJob["endTime"] ?? ""; + String beginTime = firstJob["beginTime"] ?? ""; + String hydStatus = firstJob["hydStatus"].toString() ?? ""; String hydStatusStr = ""; if (hydStatus == "0") { hydStatusStr = "营运中"; @@ -97,7 +100,7 @@ class ReservationController extends GetxController with BaseControllerMixin { if (hoursLeft > 0) { // 如果是正数,表示还有多久结束 - String timeTip = "${hoursLeft.toStringAsFixed(1)}小时后"; + String timeTip = " ${hoursLeft.toStringAsFixed(1)}小时后"; jobTipStr = "$timeTip$hydStatusStr"; } else { jobTipStr = ""; @@ -111,8 +114,10 @@ class ReservationController extends GetxController with BaseControllerMixin { print("时间解析失败: $e"); } } - }catch (e){ - Logger.d("解析失败: $e"); + } catch (e) { + Logger.d("解析失败或者没返回信息: $e"); + + jobTipStr = ""; } } } @@ -282,6 +287,7 @@ class ReservationController extends GetxController with BaseControllerMixin { 'appointment/station/updateStationStatus', data: { 'hydrogenId': hydrogenId, + 'name': name, 'siteStatus': selectedOperationStatus == "营运中" ? "0" : selectedOperationStatus == "维修中" @@ -309,6 +315,9 @@ class ReservationController extends GetxController with BaseControllerMixin { var result = BaseModel.fromJson(responseData.data); if (result.code == 0) { showSuccessToast("保存成功,已同步通知对应司机"); + + //重新刷新页面 + renderData(); } dismissLoading(); } catch (e) { @@ -325,10 +334,7 @@ class ReservationController extends GetxController with BaseControllerMixin { DialogX.to.showConfirmDialog( title: '当前设置详情', - content: Text( - jobDetailsStr, - style: const TextStyle(fontSize: 15, height: 1.5), - ), + content: Text(jobDetailsStr, style: const TextStyle(fontSize: 15, height: 1.5)), confirmText: '好的', cancelText: '取消设置', onCancel: () { @@ -342,9 +348,7 @@ class ReservationController extends GetxController with BaseControllerMixin { void _cancelJob() async { showLoading("正在取消..."); try { - var response = await HttpService.to.delete( - 'appointment/job/hyd/$jobId', - ); + var response = await HttpService.to.delete('appointment/job/hyd/$jobId'); dismissLoading(); if (response != null) { diff --git a/ln_jq_app/lib/pages/b_page/reservation/view.dart b/ln_jq_app/lib/pages/b_page/reservation/view.dart index 497d1f5..22f459c 100644 --- a/ln_jq_app/lib/pages/b_page/reservation/view.dart +++ b/ln_jq_app/lib/pages/b_page/reservation/view.dart @@ -197,6 +197,7 @@ class ReservationPage extends GetView { controller.jobTipStr, style: TextStyle(color: Colors.yellow[800], fontSize: 14), ), + SizedBox(width: 2.w), Icon(AntdIcon.question_circle, size: 14, color: Colors.yellow[800]), ], ), diff --git a/ln_jq_app/lib/pages/c_page/mine/controller.dart b/ln_jq_app/lib/pages/c_page/mine/controller.dart index 35ff0ad..f6ed010 100644 --- a/ln_jq_app/lib/pages/c_page/mine/controller.dart +++ b/ln_jq_app/lib/pages/c_page/mine/controller.dart @@ -57,7 +57,7 @@ class MineController extends GetxController with BaseControllerMixin { _fetchAccidentCount(), // 请求2:事故数 _fetchBreakRulesCount(), // 请求3:违章数 _rating(), // 司机评分 - _msgNotice(), // 红点消息 + msgNotice(), // 红点消息 ]); await renderViolation(); @@ -69,7 +69,7 @@ class MineController extends GetxController with BaseControllerMixin { } } - Future _msgNotice() async { + Future msgNotice() async { final Map requestData = { 'appFlag': 1, 'isRead': 1, diff --git a/ln_jq_app/lib/pages/c_page/mine/view.dart b/ln_jq_app/lib/pages/c_page/mine/view.dart index b28b3bc..966574f 100644 --- a/ln_jq_app/lib/pages/c_page/mine/view.dart +++ b/ln_jq_app/lib/pages/c_page/mine/view.dart @@ -82,9 +82,12 @@ class MinePage extends GetView { ), ), IconButton( - onPressed: () { + onPressed: () async { // 跳转消息中心 - Get.to(() => const MessagePage()); + var scanResult = await Get.to(() => const MessagePage()); + if (scanResult == null) { + controller.msgNotice(); + } }, // 这里的 style 是为了模拟你图片里的灰色圆形背景 style: IconButton.styleFrom( diff --git a/ln_jq_app/lib/pages/c_page/reservation/controller.dart b/ln_jq_app/lib/pages/c_page/reservation/controller.dart index a197682..17f9a4f 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/controller.dart @@ -341,12 +341,12 @@ class C_ReservationController extends GetxController with BaseControllerMixin { final startTimeStr = '$dateStr ${_formatTimeOfDay(startTime.value)}:00'; // Use helper directly - if (lastSuccessfulReservation != null && + /*if (lastSuccessfulReservation != null && lastSuccessfulReservation!.id == selectedStationId.value && lastSuccessfulReservation!.startTime == startTimeStr) { showToast("请勿重复提交相同时间段的预约,可在“查看预约”中修改"); return; - } + }*/ final reservationEndDateTime = DateTime( selectedDate.value.year,