From 1ccc4f41627cdaa65a5e638810d7b06b83f2aad7 Mon Sep 17 00:00:00 2001 From: ZHR007 Date: Tue, 2 Dec 2025 18:39:39 +0800 Subject: [PATCH] no message --- lib/controller/setting/spread_controller.dart | 22 ++++++---- lib/model/mine/chat_static_data.dart | 31 ++++++++++++++ lib/network/api_urls.dart | 2 + lib/network/user_api.dart | 4 ++ lib/network/user_api.g.dart | 32 +++++++++++++++ lib/pages/setting/match_spread_page.dart | 40 +++++++++++-------- lib/pages/setting/setting_page.dart | 13 +++--- 7 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 lib/model/mine/chat_static_data.dart diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart index e8b64ab..8b93b5d 100644 --- a/lib/controller/setting/spread_controller.dart +++ b/lib/controller/setting/spread_controller.dart @@ -163,13 +163,21 @@ class SpreadController extends GetxController with WidgetsBindingObserver { }); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data; - fluwx.open(target: MiniProgram( - username: 'gh_9ea8d46add6f', - path: "pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data!.paymentOrderId}&url=match-fee", - miniProgramType: WXMiniProgramType.preview - )); - countdownSeconds.value = 3; - SmartDialog.showToast('开始支付'); + + if(data!.freeSettlement!){ + SmartDialog.showToast('加入成功'); + GlobalData().userData!.matchmakerFlag = true; + GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory; + Get.back(result: 1); + } else { + fluwx.open(target: MiniProgram( + username: 'gh_9ea8d46add6f', + path: "pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data!.paymentOrderId}&url=match-fee", + miniProgramType: WXMiniProgramType.preview + )); + countdownSeconds.value = 3; + SmartDialog.showToast('开始支付'); + } } else { // 响应失败,抛出异常 SmartDialog.showToast(response.data.message ?? '网络异常'); diff --git a/lib/model/mine/chat_static_data.dart b/lib/model/mine/chat_static_data.dart new file mode 100644 index 0000000..ee5650c --- /dev/null +++ b/lib/model/mine/chat_static_data.dart @@ -0,0 +1,31 @@ +// 登录响应实体类 +class ChatStaticData { + final String id; + final int liveDurationMins; + final int todayCrossMicCount; + + ChatStaticData({required this.id, required this.liveDurationMins, required this.todayCrossMicCount}); + + // 从JSON映射创建实例 + factory ChatStaticData.fromJson(Map json) { + return ChatStaticData( + id: json['id'] ?? '', + liveDurationMins: json['liveDurationMins'] ?? 0, + todayCrossMicCount: json['todayCrossMicCount'] ?? 0, + ); + } + + // 转换为JSON映射 + Map toJson() { + return { + 'id': id, + 'liveDurationMins': liveDurationMins, + 'todayCrossMicCount': todayCrossMicCount, + }; + } + + @override + String toString() { + return 'LoginData(id: $id, liveDurationMins: $liveDurationMins)'; + } +} \ No newline at end of file diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index eb3ad30..3da7c62 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -100,4 +100,6 @@ class ApiUrls { static const String auditMatchmakerResult = 'dating-agency-uec/user/need-audit/matchmaker-audit'; + static const String getChatVideoStatics = + 'dating-agency-chat-audio/user/get/own-user-management'; } diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index 701ba04..e3b7ca0 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -21,6 +21,7 @@ import 'package:retrofit/retrofit.dart'; import 'package:dio/dio.dart'; import '../model/mine/authentication_data.dart'; +import '../model/mine/chat_static_data.dart'; import '../model/mine/submit_order_data.dart'; part 'user_api.g.dart'; @@ -200,4 +201,7 @@ abstract class UserApi { } ); + @GET(ApiUrls.getHxUserToken) + Future>> getChatStaticsInfo(); + } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index f2cdbe1..c3de8e0 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1234,6 +1234,38 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> + getChatStaticsInfo() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-chat-audio/user/get/hx/user/token', + 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) => ChatStaticData.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 || diff --git a/lib/pages/setting/match_spread_page.dart b/lib/pages/setting/match_spread_page.dart index 5e6586f..34c846f 100644 --- a/lib/pages/setting/match_spread_page.dart +++ b/lib/pages/setting/match_spread_page.dart @@ -153,9 +153,10 @@ class _PayItemState extends State { border: widget.active == widget.index ? Border.all(width: 1, color: const Color(0xFF7562F9)) : Border.all(width: 1, color: const Color(0xFFEEEEEE)) ), child: Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - const SizedBox(height: 32), + SizedBox(height: 40.h), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, @@ -183,22 +184,27 @@ class _PayItemState extends State { ], ), TDText("¥${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),), - const SizedBox(height: 18), + Spacer(), SizedBox( - height: 24, - child: widget.item.validityPeriodDays != null ? Text( - "有效期:${widget.item.validityPeriodDays}天", - style: TextStyle( - fontSize: 14.w, - color: Color(0xFF333333), - fontWeight: FontWeight.bold - ), - ) : Text('+${widget.item.liveDurationHours ?? '10'}小时视频相亲', - style: TextStyle( - fontSize: 12.w, - color: Color(0xFF999999), - fontWeight: FontWeight.bold - ), + height: 36.h, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + widget.item.validityPeriodDays != null ? Text( + "有效期:${widget.item.validityPeriodDays}天", + style: TextStyle( + fontSize: 14.w, + color: Color(0xFF333333), + fontWeight: FontWeight.bold + ), + ) : Text('+${widget.item.liveDurationHours ?? '10'}小时视频相亲', + style: TextStyle( + fontSize: 12.w, + color: Color(0xFF999999), + fontWeight: FontWeight.bold + ), + ) + ], ), ), ], diff --git a/lib/pages/setting/setting_page.dart b/lib/pages/setting/setting_page.dart index 73ba6b9..eebd3dc 100644 --- a/lib/pages/setting/setting_page.dart +++ b/lib/pages/setting/setting_page.dart @@ -29,7 +29,6 @@ class SettingPage extends StatelessWidget { cells: [ TDCell( arrow: false, - height: 60.h, title: '允许中间邀请弹窗', rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) { return false; @@ -37,7 +36,6 @@ class SettingPage extends StatelessWidget { ), TDCell( arrow: false, - height: 60.h, title: '后台播放', rightIconWidget: TDSwitch( isOn: true, @@ -49,7 +47,6 @@ class SettingPage extends StatelessWidget { ), TDCell( arrow: false, - height: 60.h, title: '语音/视频通话提示音', rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) { @@ -62,10 +59,10 @@ class SettingPage extends StatelessWidget { TDCellGroup( theme: TDCellGroupTheme.cardTheme, cells: [ - TDCell(arrow: true, height: 60.h, title: '安全中心', onClick: (cell) { + TDCell(arrow: true, title: '安全中心', onClick: (cell) { print('安全中心'); }), - TDCell(arrow: true, height: 60.h, title: '黑名单', onClick: (cell) { + TDCell(arrow: true, title: '黑名单', onClick: (cell) { Get.to(() => BlacklistPage()); }), ], @@ -74,11 +71,11 @@ class SettingPage extends StatelessWidget { TDCellGroup( theme: TDCellGroupTheme.cardTheme, cells: [ - TDCell(arrow: true, height: 60.h, title: '系统权限管理'), - TDCell(arrow: true, height: 60.h, title: '消息通知', onClick: (cell) { + TDCell(arrow: true, title: '系统权限管理'), + TDCell(arrow: true, title: '消息通知', onClick: (cell) { Get.to(() => NoticePage()); }), - TDCell(arrow: true, height: 60.h, title: '检查更新', onClick: (cell) { + TDCell(arrow: true, title: '检查更新', onClick: (cell) { // _showUpdateDialog(); controller.checkVersion(); },