From a2bf9c7c5d0041b0b774eb1a622bf53e606b2ac7 Mon Sep 17 00:00:00 2001 From: ZHR007 Date: Wed, 3 Dec 2025 10:08:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BA=A2=E5=A8=98=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/discover/room_controller.dart | 2 ++ lib/controller/setting/spread_controller.dart | 7 +++++-- lib/network/user_api.dart | 2 +- lib/network/user_api.g.dart | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/controller/discover/room_controller.dart b/lib/controller/discover/room_controller.dart index 0d60866..72b73cd 100644 --- a/lib/controller/discover/room_controller.dart +++ b/lib/controller/discover/room_controller.dart @@ -183,6 +183,8 @@ class RoomController extends GetxController with WidgetsBindingObserver { } Future joinChat(CurrentRole role) async { + final granted = await _ensureRtcPermissions(); + if (!granted) return; final data = { 'channelId': RTCManager.instance.currentChannelId, 'seatNumber': role == CurrentRole.maleAudience ? 1 : 2, diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart index bb4a51b..6cc856b 100644 --- a/lib/controller/setting/spread_controller.dart +++ b/lib/controller/setting/spread_controller.dart @@ -139,8 +139,11 @@ class SpreadController extends GetxController with WidgetsBindingObserver { final response = await _userApi.getChatStaticsInfo(); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data!; - if(data.liveDurationMins >= 600 && !matchmakerFlag.value){ - canApply = true; + if(roseList[activePay.value].liveDurationHours != null){ + int hours = int.parse(roseList[activePay.value].liveDurationHours!); + if(hours > 0 && data.liveDurationMins >= 60 * hours && !matchmakerFlag.value){ + canApply = true; + } } } } catch (e) { diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index e3b7ca0..e67598b 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -201,7 +201,7 @@ abstract class UserApi { } ); - @GET(ApiUrls.getHxUserToken) + @GET(ApiUrls.getChatVideoStatics) Future>> getChatStaticsInfo(); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index c3de8e0..27915b5 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1245,7 +1245,7 @@ class _UserApi implements UserApi { Options(method: 'GET', headers: _headers, extra: _extra) .compose( _dio.options, - 'dating-agency-chat-audio/user/get/hx/user/token', + 'dating-agency-chat-audio/user/get/own-user-management', queryParameters: queryParameters, data: _data, ) From 403ef7062dc3f451b36b33c4978b6657c5e49621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Wed, 3 Dec 2025 11:27:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/mine/my_friend_controller.dart | 4 ++ lib/network/api_urls.dart | 4 +- lib/network/network_config.dart | 20 ++++++++- lib/network/user_api.dart | 8 ++++ lib/network/user_api.g.dart | 42 ++++++++++++++++++- 5 files changed, 74 insertions(+), 4 deletions(-) diff --git a/lib/controller/mine/my_friend_controller.dart b/lib/controller/mine/my_friend_controller.dart index de8e840..339f0af 100644 --- a/lib/controller/mine/my_friend_controller.dart +++ b/lib/controller/mine/my_friend_controller.dart @@ -14,4 +14,8 @@ class MyFriendController extends GetxController with GetSingleTickerProviderStat tabController = TabController(length: 4, vsync: this); } + getFriendList() async { + + } + } \ No newline at end of file diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index 3da7c62..249062c 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -87,7 +87,9 @@ class ApiUrls { static const String getDongwoMarriageInformationDetail = 'dating-agency-service/user/get/dongwo/marriage-information-detail'; static const String getPaymentOrderDetail = - '/dating-agency-mall/user/get/payment-order/detail'; + 'dating-agency-mall/user/get/payment-order/detail'; + static const String userPageFriendRelation = + 'dating-agency-chat-audio/user/page/friend-relation'; //首页相关接口 static const String getMarriageList = diff --git a/lib/network/network_config.dart b/lib/network/network_config.dart index c892bf5..39ff207 100644 --- a/lib/network/network_config.dart +++ b/lib/network/network_config.dart @@ -1,3 +1,6 @@ +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/controller/message/conversation_controller.dart'; +import 'package:dating_touchme_app/im/im_manager.dart'; import 'package:dio/dio.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart' hide Response; @@ -91,6 +94,9 @@ class ResponseInterceptor extends Interceptor { if (code == 0) { // 请求成功 handler.next(response); + } else if(code == 401) { + _showError("登录已过期,请重新登录"); + _handleTokenExpired(); } else { // 业务错误 final message = data['message'] ?? '请求失败'; @@ -150,10 +156,20 @@ class ResponseInterceptor extends Interceptor { SmartDialog.showToast(message, displayTime: const Duration(seconds: 2)); } - void _handleTokenExpired() { + void _handleTokenExpired() async { // 处理token过期逻辑,如清除本地数据、跳转登录页等 // 这里可以使用Get.offAllNamed('/login')等方式跳转 - GetStorage().remove('token'); + // 先退出 IM 登录 + await IMManager.instance.logout(); + // 清除会话列表和用户信息缓存 + if (Get.isRegistered()) { + final conversationController = Get.find(); + conversationController.clearConversations(); + } + // 清除本地存储 + GetStorage().erase(); + // 清除全局数据 + GlobalData().logout(); Get.offAll(() => LoginPage()); } } \ No newline at end of file diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index e3b7ca0..9c61a19 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -204,4 +204,12 @@ abstract class UserApi { @GET(ApiUrls.getHxUserToken) Future>> getChatStaticsInfo(); + + @GET(ApiUrls.userPageFriendRelation) + Future>> userPageFriendRelation( + { + @Query('pageNum') required int pageNum, + @Query('pageSize') required int pageSize, + } + ); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index c3de8e0..08a145f 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1211,7 +1211,7 @@ class _UserApi implements UserApi { Options(method: 'GET', headers: _headers, extra: _extra) .compose( _dio.options, - '/dating-agency-mall/user/get/payment-order/detail', + 'dating-agency-mall/user/get/payment-order/detail', queryParameters: queryParameters, data: _data, ) @@ -1266,6 +1266,46 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> userPageFriendRelation({ + required int pageNum, + required int pageSize, + }) async { + final _extra = {}; + final queryParameters = { + r'pageNum': pageNum, + r'pageSize': pageSize, + }; + final _headers = {}; + const Map? _data = null; + final _options = + _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-chat-audio/user/page/friend-relation', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl), + ), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.fromJson( + _result.data!, + (json) => WithdrawAuditData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes ||