diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart index dcc0153..6cde2ff 100644 --- a/lib/controller/setting/spread_controller.dart +++ b/lib/controller/setting/spread_controller.dart @@ -87,8 +87,7 @@ class SpreadController extends GetxController with WidgetsBindingObserver { if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){ matchmakerFlag.value = true; } - getRoseList(); - getChatInfo(); + initDataList(); } @override @@ -131,9 +130,14 @@ class SpreadController extends GetxController with WidgetsBindingObserver { super.onClose(); } - getChatInfo() async { + initDataList() async { try{ + final result = await _userApi.getMatchmakerFee(); + if (result.data.isSuccess && result.data.data != null) { + roseList.value = result.data.data!.records; + } final response = await _userApi.getChatStaticsInfo(); + print('canApply: 137'); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data!; if(roseList[activePay.value].liveDurationHours != null){ @@ -143,25 +147,16 @@ class SpreadController extends GetxController with WidgetsBindingObserver { } } } - } catch (e) { - print('spread: $e'); - } - } - - getRoseList() async { - try{ - final response = await _userApi.getMatchmakerFee(); - if (response.data.isSuccess && response.data.data != null) { - final data = response.data.data!.records; - roseList.addAll(data.toList()); - if(matchmakerFlag.value){ - final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!); - enableIndex.value = index >= 0 ? index : 0; - changePayActive(enableIndex.value); - } + print('canApply: $canApply'); + if(matchmakerFlag.value){ + final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!); + enableIndex.value = index >= 0 ? index : 0; + changePayActive(enableIndex.value); + } else { + changePayActive(0); } } catch (e) { - print('玫瑰列表获取失败: $e'); + print('spread: $e'); } } diff --git a/lib/model/mine/chat_static_data.dart b/lib/model/mine/chat_static_data.dart index ee5650c..8982190 100644 --- a/lib/model/mine/chat_static_data.dart +++ b/lib/model/mine/chat_static_data.dart @@ -1,6 +1,6 @@ // 登录响应实体类 class ChatStaticData { - final String id; + final int id; final int liveDurationMins; final int todayCrossMicCount;