From 968e3ed212f71a92eb59643be3ff7c7319a0b13b Mon Sep 17 00:00:00 2001 From: Jolie <412895109@qq.com> Date: Fri, 28 Nov 2025 16:19:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(network):=20=E7=A7=BB=E9=99=A4API?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E4=B8=AD=E7=9A=84=5Fresult?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在多个API文件中统一移除了errorLogger.logError调用中的_result参数 - 优化错误日志记录逻辑,减少不必要的参数传递 - 涉及home_api.g.dart、rtc_api.g.dart和user_api.g.dart等多个网络请求文件 - 统一了所有catch块中的错误处理方式 feat(payment): 新增支付订单详情接口 - 在user_api.g.dart中添加getPaymentOrderDetail方法 - 实现了获取支付订单详情的网络请求逻辑 - 支持通过订单ID查询支付详情信息 - 返回PaymentDetailData数据模型 feat(ui): 调整直播间页面UI布局 - 移除了直播结束页面的关注按钮及相关交互逻辑 - 调整了直播结束页面的间距和布局结构 - 优化了直播间主播展示区域的视频视图位置 - 简化了直播间关闭按钮的overlay显示逻辑 --- lib/network/home_api.g.dart | 2 +- lib/network/rtc_api.g.dart | 24 ++--- lib/network/user_api.g.dart | 100 ++++++++++++------ lib/pages/discover/live_end_page.dart | 27 +---- lib/pages/discover/live_room_page.dart | 7 +- .../live/live_room_anchor_showcase.dart | 28 ++--- 6 files changed, 99 insertions(+), 89 deletions(-) diff --git a/lib/network/home_api.g.dart b/lib/network/home_api.g.dart index e25687c..84908ed 100644 --- a/lib/network/home_api.g.dart +++ b/lib/network/home_api.g.dart @@ -58,7 +58,7 @@ class _HomeApi implements HomeApi { ), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); diff --git a/lib/network/rtc_api.g.dart b/lib/network/rtc_api.g.dart index ceac9f1..5aa117a 100644 --- a/lib/network/rtc_api.g.dart +++ b/lib/network/rtc_api.g.dart @@ -45,7 +45,7 @@ class _RtcApi implements RtcApi { (json) => RtcChannelData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -76,7 +76,7 @@ class _RtcApi implements RtcApi { (json) => RtcChannelData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -107,7 +107,7 @@ class _RtcApi implements RtcApi { (json) => RtcChannelData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -143,7 +143,7 @@ class _RtcApi implements RtcApi { (json) => RtcChannelDetail.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -177,7 +177,7 @@ class _RtcApi implements RtcApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -212,7 +212,7 @@ class _RtcApi implements RtcApi { (json) => RtcSeatUserInfo.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -246,7 +246,7 @@ class _RtcApi implements RtcApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -280,7 +280,7 @@ class _RtcApi implements RtcApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -311,7 +311,7 @@ class _RtcApi implements RtcApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -351,7 +351,7 @@ class _RtcApi implements RtcApi { ), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -392,7 +392,7 @@ class _RtcApi implements RtcApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -426,7 +426,7 @@ class _RtcApi implements RtcApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index 758c6e7..f2cdbe1 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -46,7 +46,7 @@ class _UserApi implements UserApi { (json) => LoginData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -79,7 +79,7 @@ class _UserApi implements UserApi { (json) => UserBaseData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -111,7 +111,7 @@ class _UserApi implements UserApi { (json) => UserData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -145,7 +145,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -179,7 +179,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -213,7 +213,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -247,7 +247,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -289,7 +289,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -320,7 +320,7 @@ class _UserApi implements UserApi { (json) => json as String, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -351,7 +351,7 @@ class _UserApi implements UserApi { (json) => OssData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -391,7 +391,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -425,7 +425,7 @@ class _UserApi implements UserApi { (json) => UserRoseData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -468,7 +468,7 @@ class _UserApi implements UserApi { (json) => RoseHistoryData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -505,7 +505,7 @@ class _UserApi implements UserApi { (json) => SubmitOrderData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -548,7 +548,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -591,7 +591,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -634,7 +634,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -677,7 +677,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -720,7 +720,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -754,7 +754,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -796,7 +796,7 @@ class _UserApi implements UserApi { : List.empty(), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -830,7 +830,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -867,7 +867,7 @@ class _UserApi implements UserApi { (json) => BankCardOcrData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -901,7 +901,7 @@ class _UserApi implements UserApi { (json) => WithdrawData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -935,7 +935,7 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -975,7 +975,7 @@ class _UserApi implements UserApi { (json) => WithdrawAuditData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1007,7 +1007,7 @@ class _UserApi implements UserApi { (json) => UserInfoData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1044,7 +1044,7 @@ class _UserApi implements UserApi { (json) => WalletAccountData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1090,7 +1090,7 @@ class _UserApi implements UserApi { WalletAccountRecordData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1122,7 +1122,7 @@ class _UserApi implements UserApi { (json) => UserInfoData.fromJson(json as Map), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1160,7 +1160,7 @@ class _UserApi implements UserApi { ), ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); @@ -1191,7 +1191,43 @@ class _UserApi implements UserApi { (json) => json as dynamic, ); } on Object catch (e, s) { - errorLogger?.logError(e, s, _options, _result); + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future>> getPaymentOrderDetail({ + required String id, + }) async { + final _extra = {}; + final queryParameters = {r'id': id}; + final _headers = {}; + const Map? _data = null; + final _options = + _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + '/dating-agency-mall/user/get/payment-order/detail', + 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) => PaymentDetailData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); rethrow; } final httpResponse = HttpResponse(_value, _result); diff --git a/lib/pages/discover/live_end_page.dart b/lib/pages/discover/live_end_page.dart index 3158392..8b4bb67 100644 --- a/lib/pages/discover/live_end_page.dart +++ b/lib/pages/discover/live_end_page.dart @@ -111,37 +111,13 @@ class LiveEndPage extends StatelessWidget { color: Colors.white, ), ), - SizedBox(width: 12.w), - // 关注按钮 - Container( - padding: EdgeInsets.symmetric( - horizontal: 16.w, - vertical: 6.w, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.w), - border: Border.all( - color: Colors.white, - width: 1.w, - ), - ), - child: Text( - '关注', - style: TextStyle( - fontSize: 14.w, - color: Colors.white, - ), - ), - ).onTap(() { - // TODO: 实现关注功能 - print('点击关注'); - }), ], ), SizedBox(height: 60.w), // 状态消息(带横线) Row( children: [ + SizedBox(width: 40.w,), Expanded( child: Container( height: 1.w, @@ -164,6 +140,7 @@ class LiveEndPage extends StatelessWidget { color: Colors.white.withOpacity(0.3), ), ), + SizedBox(width: 40.w,), ], ), ], diff --git a/lib/pages/discover/live_room_page.dart b/lib/pages/discover/live_room_page.dart index fe13408..d2af234 100644 --- a/lib/pages/discover/live_room_page.dart +++ b/lib/pages/discover/live_room_page.dart @@ -181,11 +181,8 @@ class _LiveRoomPageState extends State { popularityText: popularityText, avatarAsset: avatarAsset, onCloseTap: () { - _overlayController.show(); - // 延迟返回,确保 overlay 先显示 - Future.microtask(() { - Get.back(); - }); + _overlayController.toggle(); + Get.back(); }, ); }), diff --git a/lib/widget/live/live_room_anchor_showcase.dart b/lib/widget/live/live_room_anchor_showcase.dart index 99d2769..57212b0 100644 --- a/lib/widget/live/live_room_anchor_showcase.dart +++ b/lib/widget/live/live_room_anchor_showcase.dart @@ -219,6 +219,20 @@ class _LiveRoomAnchorShowcaseState extends State { engine != null ? Stack( children: [ + AgoraVideoView( + controller: isCurrentUser + ? VideoViewController( + rtcEngine: engine, + canvas: const VideoCanvas(uid: 0), + ) + : VideoViewController.remote( + rtcEngine: engine, + canvas: VideoCanvas(uid: userInfo.uid!), + connection: RtcConnection( + channelId: _rtcManager.currentChannelId ?? '', + ), + ), + ), Positioned( top: 5.w, right: 5.w, @@ -301,20 +315,6 @@ class _LiveRoomAnchorShowcaseState extends State { ], ), ), - AgoraVideoView( - controller: isCurrentUser - ? VideoViewController( - rtcEngine: engine, - canvas: const VideoCanvas(uid: 0), - ) - : VideoViewController.remote( - rtcEngine: engine, - canvas: VideoCanvas(uid: userInfo.uid!), - connection: RtcConnection( - channelId: _rtcManager.currentChannelId ?? '', - ), - ), - ), ], ) : _roomController.currentRole == CurrentRole.broadcaster