diff --git a/android/app/src/main/res/xml/network_security_config.xml b/android/app/src/main/res/xml/network_security_config.xml
index 61ebdf0..8b145c5 100644
--- a/android/app/src/main/res/xml/network_security_config.xml
+++ b/android/app/src/main/res/xml/network_security_config.xml
@@ -11,6 +11,6 @@
- dating-agency-test.oss-accelerate.aliyuncs.com
+ dating-agency-download-test.qniao.cn
\ No newline at end of file
diff --git a/lib/controller/discover/room_controller.dart b/lib/controller/discover/room_controller.dart
index c5d184e..6342779 100644
--- a/lib/controller/discover/room_controller.dart
+++ b/lib/controller/discover/room_controller.dart
@@ -9,6 +9,7 @@ import 'package:dating_touchme_app/model/rtc/rtc_channel_data.dart';
import 'package:dating_touchme_app/model/rtc/rtc_channel_detail.dart';
import 'package:dating_touchme_app/network/network_service.dart';
import 'package:dating_touchme_app/pages/mine/edit_info_page.dart';
+import 'package:dating_touchme_app/pages/setting/match_league_page.dart';
import 'package:dating_touchme_app/rtc/rtc_manager.dart';
import 'package:dating_touchme_app/rtc/rtm_manager.dart';
import 'package:dating_touchme_app/service/live_chat_message_service.dart';
@@ -143,7 +144,6 @@ class RoomController extends GetxController with WidgetsBindingObserver {
if (isLive.value) {
return;
}
-
// 检查是否正在通话中(包括呼叫中)
try {
// 先尝试使用 Get.find 获取已注册的实例,如果不存在再使用 instance
@@ -749,7 +749,12 @@ class RoomController extends GetxController with WidgetsBindingObserver {
}
}
- void registerMatch() async {
+ void registerMatch(int type) async {
+ if (GlobalData().userData!.profilePhoto == null || GlobalData().userData!.profilePhoto!.isEmpty) {
+ SmartDialog.showToast('请先上传头像');
+ await Get.to(() => EditInfoPage());
+ return;
+ }
if (GlobalData().userData!.auditProfilePhoto != null) {
showGeneralDialog(
context: Get.context!,
@@ -763,18 +768,16 @@ class RoomController extends GetxController with WidgetsBindingObserver {
);
return;
}
- if (GlobalData().userData!.profilePhoto == null || GlobalData().userData!.profilePhoto!.isEmpty) {
- SmartDialog.showToast('请先上传头像');
- await Get.to(() => EditInfoPage());
- return;
- }
if(GlobalData().userData!.identityCard == null || GlobalData().userData!.identityCard!.isEmpty){
SmartDialog.showToast('请先进行实名认证');
await Get.to(() => RealNamePage(type: 1));
return;
}
- await Get.to(() => MatchSpreadPage());
- matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
+ if(type == 1){
+ Get.to(() => MatchLeaguePage());
+ } else {
+ await createRtcChannel();
+ }
}
/// 踢出 RTC 频道用户
diff --git a/lib/controller/mine/auth_controller.dart b/lib/controller/mine/auth_controller.dart
index 909a948..e2a70fe 100644
--- a/lib/controller/mine/auth_controller.dart
+++ b/lib/controller/mine/auth_controller.dart
@@ -116,18 +116,16 @@ class AuthController extends GetxController {
GlobalData().userData!.name = name.value;
SmartDialog.showToast('认证成功');
getInfo();
- final RoomController _roomController;
- _roomController = Get.isRegistered()
+ final RoomController roomController = Get.isRegistered()
? Get.find()
: Get.put(RoomController());
- _roomController.matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
-
+ roomController.matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
final HomeController hController = Get.find();
hController.refreshRecommendData();
hController.refreshNearbyData();
- if(type == 1){
+ if(type == 1 && !GlobalData().userData!.matchmakerFlag!){
// 进入认证成功之后的下一个页面;
Get.off(() => MatchSpreadPage());
} else {
@@ -139,13 +137,9 @@ class AuthController extends GetxController {
} catch (e) {
// SmartDialog.showToast('网络请求失败,请检查网络连接');
// SmartDialog.showToast(response.data.message);
- } finally {
-
}
}
-
-
getInfo() async {
final result = await _userApi.getMarriageInformationDetail();
// print(result.data);
diff --git a/lib/controller/mine/league_controller.dart b/lib/controller/mine/league_controller.dart
index a3acee4..ca41aa6 100644
--- a/lib/controller/mine/league_controller.dart
+++ b/lib/controller/mine/league_controller.dart
@@ -1,110 +1,50 @@
import 'dart:async';
+import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
+import 'package:dating_touchme_app/pages/setting/match_spread_page.dart';
import 'package:get/get.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import '../../network/user_api.dart';
-import '../../pages/setting/match_spread_page.dart';
import '../global.dart';
class LeagueController extends GetxController {
+
late UserApi _userApi;
- final phone = ''.obs;
- // 手机号输入
- final phoneNumber = ''.obs;
- // 验证码输入
- final verificationCode = ''.obs;
- // 是否正在发送验证码
- final isSendingCode = false.obs;
- // 倒计时秒数
- final countdownSeconds = 0.obs;
- final agree = false.obs;
+ final genderCode = 0.obs;
+ final consumption = ChatStaticData(liveDurationMins: 0).obs;
+ final hours = 0.obs;
+ final canApply = false.obs;
@override
void onInit() {
super.onInit();
// 从全局依赖中获取UserApi
_userApi = Get.find();
- phone.value = GlobalData().userData!.phone!;
- }
-
- // 获取验证码
- Future getVerificationCode() async {
- if (countdownSeconds.value > 0) {
- return;
- }
- // 验证手机号格式
- if (phoneNumber.value.isEmpty || phoneNumber.value.length != 11) {
- SmartDialog.showToast('请输入正确的手机号');
- return;
- }
- isSendingCode.value = true;
- try {
- // 构建请求参数
- final params = {
- 'purpose': 2, // 红娘申请
- 'verifiableAccount': phoneNumber.value,
- 'verifiableAccountType': 1, // 手机
- };
- // 调用UserApi中的验证码接口
- final response = await _userApi.getVerificationCode(params);
- // 处理响应
- if (response.data.isSuccess) {
- // 生产环境移除打印,可考虑使用正式的日志框架
- SmartDialog.showToast('验证码发送成功');
- // 开始倒计时
- countdownSeconds.value = 60;
- startCountdown();
- } else {
- SmartDialog.showToast(response.data.message);
- }
- } catch (e) {
- SmartDialog.showToast('网络请求失败,请重试');
- } finally {
- isSendingCode.value = false;
- }
+ genderCode.value = GlobalData().userData!.genderCode!;
+ fetchData();
}
- // 开始倒计时
- void startCountdown() {
- Future.delayed(const Duration(seconds: 1), () {
- if (countdownSeconds.value > 0) {
- countdownSeconds.value--;
- startCountdown();
- } else {
- isSendingCode.value = false;
- }
- });
- }
+ fetchData() async {
+ try{
+ final response = await _userApi.getChatStaticsInfo();
+ if (response.data.isSuccess && response.data.data != null) {
+ consumption.value = response.data.data!;
+ }
+ final result = await _userApi.getMatchmakerRequirement();
+ if (result.data.isSuccess && result.data.data != null) {
+ final roseList = result.data.data!;
+ hours.value = roseList[0].liveDurationHours!;
+ }
+ canApply.value = consumption.value.liveDurationMins! >= hours.value * 60;
+ } catch (e) {
+ print('spread: $e');
+ }
+ }
- Future submitInfo() async {
- if(isSendingCode.value){
- return;
- }
- if (phoneNumber.value.isEmpty) {
- SmartDialog.showToast('请输入手机号');
- return;
- }
- if (verificationCode.value.isEmpty) {
- SmartDialog.showToast('请输入验证码');
- return;
- }
- isSendingCode.value = true;
- try {
- // 调用登录接口
- SmartDialog.showLoading(msg: '处理中');
- final param = { 'phone': phoneNumber.value, 'captcha': verificationCode.value};
- final response = await _userApi.updatePhone(param);
- // 处理响应
- if (response.data.isSuccess) {
- SmartDialog.showToast('提交成功');
- Get.off(() => MatchSpreadPage());
- } else {
- SmartDialog.showToast(response.data.message);
- }
- } catch (e) {
- SmartDialog.showToast('网络请求失败,请检查网络连接');
- } finally {
- SmartDialog.dismiss();
- isSendingCode.value = true;
+ applyMatcher(){
+ if(canApply.value){
+ Get.off(() => MatchSpreadPage());
+ } else {
+ Get.back();
}
}
diff --git a/lib/controller/mine/mine_controller.dart b/lib/controller/mine/mine_controller.dart
index 381607c..e6d838d 100644
--- a/lib/controller/mine/mine_controller.dart
+++ b/lib/controller/mine/mine_controller.dart
@@ -9,6 +9,7 @@ import 'package:dating_touchme_app/pages/mine/real_name_page.dart';
import 'package:dating_touchme_app/pages/mine/rose_page.dart';
import 'package:dating_touchme_app/pages/mine/user_help_center_page.dart';
import 'package:dating_touchme_app/pages/setting/match_spread_page.dart';
+import 'package:dating_touchme_app/pages/setting/match_task_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
@@ -24,6 +25,7 @@ class MineController extends GetxController {
final countData = UserCountData(friendNum: 0, friendApplyNum: 0, visitorNum:0).obs;
late UserApi _userApi;
+ var matchmakerFlag = false.obs;
@override
void onInit() {
@@ -31,9 +33,10 @@ class MineController extends GetxController {
userData.value = GlobalData().userData;
userId.value = GlobalData().userId;
_userApi = Get.find();
+ matchmakerFlag.value = GlobalData().userData!.matchmakerFlag!;
}
- void registerMatch() async {
+ void registerMatch(int type) async {
if (GlobalData().userData!.auditProfilePhoto != null) {
showGeneralDialog(
context: Get.context!,
@@ -57,7 +60,11 @@ class MineController extends GetxController {
await Get.to(() => RealNamePage(type: 1));
return;
}
- await Get.to(() => MatchSpreadPage());
+ if(type == 1){
+ await Get.to(() => MatchSpreadPage());
+ } else if(type == 2){
+ Get.to(() => MatchTaskPage());
+ }
}
}
\ No newline at end of file
diff --git a/lib/controller/mine/user_controller.dart b/lib/controller/mine/user_controller.dart
index 72c2ca2..66430ca 100644
--- a/lib/controller/mine/user_controller.dart
+++ b/lib/controller/mine/user_controller.dart
@@ -98,10 +98,18 @@ class UserController extends GetxController {
if (result.data.isSuccess) {
if(result.data.data == null){
var information = UserData();
- information.matchmakerFlag = baseInfo.matchmakerFlag;
- if(information.matchmakerFlag!){
- information.matchmakerType = baseInfo.matchmakerType;
+
+ if(baseInfo.liveMatchmaker != null && baseInfo.liveMatchmaker!.enable!){
+ information.matchmakerFlag = true;
+ information.matchmakerType = baseInfo.liveMatchmaker!.type;
+ } else {
+ information.matchmakerFlag = false;
}
+
+ // information.matchmakerFlag = baseInfo.matchmakerFlag;
+ // if(information.matchmakerFlag!){
+ // information.matchmakerType = baseInfo.matchmakerType;
+ // }
information.realName = baseInfo.realName;
information.phone = baseInfo.phone;
GlobalData().userData = information;
@@ -115,9 +123,11 @@ class UserController extends GetxController {
return;
}
final information = result.data.data!;
- information.matchmakerFlag = baseInfo.matchmakerFlag;
- if(information.matchmakerFlag!){
- information.matchmakerType = baseInfo.matchmakerType;
+ if(baseInfo.liveMatchmaker != null && baseInfo.liveMatchmaker!.enable!){
+ information.matchmakerFlag = true;
+ information.matchmakerType = baseInfo.liveMatchmaker!.type;
+ } else {
+ information.matchmakerFlag = false;
}
information.realName = baseInfo.realName;
information.phone = baseInfo.phone;
diff --git a/lib/controller/setting/setting_controller.dart b/lib/controller/setting/setting_controller.dart
index 5a175cb..a7d028f 100644
--- a/lib/controller/setting/setting_controller.dart
+++ b/lib/controller/setting/setting_controller.dart
@@ -5,6 +5,7 @@ import 'package:dating_touchme_app/controller/discover/room_controller.dart';
import 'package:dating_touchme_app/controller/overlay_controller.dart';
import 'package:dating_touchme_app/im/im_manager.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
+import 'package:dating_touchme_app/pages/main/update_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@@ -50,10 +51,12 @@ class SettingController extends GetxController {
Future checkVersion() async {
try {
final response = await _userApi.getAppVersionInfo(os: 1, code: int.parse(buildNumber.value));
- print(response);
if (response.data.isSuccess && response.data.data != null) {
AppVersion version = response.data.data!;
- _showUpdateDialog(version);
+ showDialog(
+ context: Get.context!,
+ builder: (context) => UpdateDialog(version: version)
+ );
}
} catch (e) {
print('检测版本跟新失败: $e');
@@ -100,149 +103,5 @@ class SettingController extends GetxController {
GlobalData().logout();
}
- void updateApplication(){
-
- }
-
- // 弹出版本升级的dialog
- void _showUpdateDialog(AppVersion version){
- Navigator.of(Get.context!).push(TDSlidePopupRoute(
- modalBarrierColor: TDTheme.of(Get.context!).fontGyColor2,
- slideTransitionFrom: SlideTransitionFrom.center,
- builder: (context) {
- return Material(
- color: Colors.transparent,
- child: Container(
- color: Colors.transparent,
- width: 299.w,
- padding: EdgeInsets.only(top: 56.w),
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- Container(
- width: 299.w,
- padding: EdgeInsets.only(
- top: 147.w,
- left: 30.w,
- right: 30.w,
- bottom: 25.w
- ),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(18.w)),
- color: Colors.white
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- version.title!,
- style: TextStyle(
- fontSize: 16.w,
- fontWeight: FontWeight.w500
- ),
- ),
- SizedBox(height: 14.w,),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(
- width: 204.w,
- child: Text(
- version.description!,
- style: TextStyle(
- fontSize: 12.w,
- ),
- ),
- )
- ],
- ),
- SizedBox(height: 32.w,),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: 113.w,
- height: 40.w,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(9.w)),
- color: const Color.fromRGBO(245, 245, 245, 1)
- ),
- child: Center(
- child: Text(
- "暂不更新",
- style: TextStyle(
- fontSize: 15.w,
- color: const Color.fromRGBO(144, 144, 144, 1)
- ),
- ),
- ),
- ).onTap((){
- Navigator.of(context).pop();
- }),
- Container(
- width: 113.w,
- height: 40.w,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(9.w)),
- color: const Color.fromRGBO(245, 245, 245, 1),
- gradient: const LinearGradient(
- begin: Alignment.centerLeft,
- end: Alignment.centerRight, // 对应 CSS 90deg
- colors: [
- Color.fromRGBO(131, 89, 255, 1), // rgba(131, 89, 255, 1)
- Color.fromRGBO(61, 138, 224, 1), // rgba(61, 138, 224, 1)
- ],
- ),
- ),
- child: Center(
- child: Text(
- "立即升级",
- style: TextStyle(
- fontSize: 15.w,
- fontWeight: FontWeight.w500,
- color: Colors.white
- ),
- ),
- ),
- ).onTap((){
- updateApplication();
- }),
- ],
- )
- ],
- ),
- ),
- Positioned(
- left: 0,
- top: -56.w,
- child: Image.asset(
- Assets.imagesUpdataBg,
- width: 299.w,
- ),
- ),
- Positioned(
- left: 11.w,
- top: -14.w,
- child: Image.asset(
- Assets.imagesUpdataIcon,
- width: 36.w,
- ),
- ),
- Positioned(
- left: 43.w,
- top: 29.w,
- child: Image.asset(
- Assets.imagesUpdataFont,
- width: 76.w,
- ),
- )
- ],
- ),
- ),
- );
- }));
- }
-
}
diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart
index a02b00c..1493438 100644
--- a/lib/controller/setting/spread_controller.dart
+++ b/lib/controller/setting/spread_controller.dart
@@ -1,17 +1,17 @@
import 'package:dating_touchme_app/controller/global.dart';
-import 'package:dating_touchme_app/model/mine/rose_data.dart';
+import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
+import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/network/user_api.dart';
-import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
-class SpreadController extends GetxController with WidgetsBindingObserver {
+class SpreadController extends GetxController {
// UserApi实例
late UserApi _userApi;
- final roseList = [].obs;
-
+ final roseList = [].obs;
+ final loading = true.obs;
final roseNum = 0.obs;
final payChecked = true.obs;
@@ -20,8 +20,8 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
final enableIndex = (-1).obs;
final Fluwx fluwx = Fluwx();
final matchmakerFlag = false.obs;
- final button = '去相亲'.obs;
- bool canApply = false;
+ final button = '立即申请'.obs;
+ final canApply = false.obs;
String paymentOrderId = '';
final revenue = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
@@ -29,48 +29,109 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
].obs;
+ final userData = GlobalData().userData.obs;
+ final userId = GlobalData().userId.obs;
+
+ final consumption = ChatStaticData().obs;
+ // final nowBankCard = BankCardData().obs;
+
+ // changePayActive(int index){
+ // if(index < enableIndex.value && enableIndex.value >= 0){
+ // return;
+ // }
+ // activePay.value = index;
+ // if(matchmakerFlag.value){
+ // if(activePay.value > enableIndex.value){
+ // button.value = '立即升级';
+ // } else if(activePay.value == 0){
+ // button.value = '去直播';
+ // } else {
+ // button.value = '立即续费';
+ // }
+ // } else if(activePay.value == 0){
+ // button.value = canApply.value ? '免费加入' : '去相亲';
+ // } else {
+ // button.value = '立即加入';
+ // }
+ // // 实习红娘
+ // if(roseList[activePay.value].type == 88804){
+ // revenue.value = [
+ // {'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
+ // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
+ // {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
+ // {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
+ // ];
+ // } else if(roseList[activePay.value].type == 88803){
+ // revenue.value = [
+ // {'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
+ // {'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
+ // {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
+ // {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
+ // ];
+ // } else if(roseList[activePay.value].type == 88802){
+ // revenue.value = [
+ // {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
+ // // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
+ // {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
+ // {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
+ // ];
+ // } else if(roseList[activePay.value].type == 88801){
+ // revenue.value = [
+ // {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
+ // // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
+ // {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
+ // {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
+ // ];
+ // }
+ //
+ // }
+ // 倒计时秒数
+ final countdownSeconds = 0.obs;
+
+ @override
+ void onInit() {
+ super.onInit();
+ // WidgetsBinding.instance.addObserver(this);
+ _userApi = Get.find();
+ if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
+ matchmakerFlag.value = true;
+ }
+ initDataList();
+ }
changePayActive(int index){
if(index < enableIndex.value && enableIndex.value >= 0){
return;
}
activePay.value = index;
- if(matchmakerFlag.value){
- if(activePay.value > enableIndex.value){
- button.value = '立即升级';
- } else if(activePay.value == 0){
- button.value = '去直播';
- } else {
- button.value = '立即续费';
+ canApply.value = false;
+ int hours = roseList[activePay.value].liveDurationHours!;
+ int rose = roseList[activePay.value].liveConsumptionAmount!;
+ if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
+ if(rose <= 0){
+ canApply.value = true;
+ } else if(consumption.value.liveConsumptionAmount! >= rose){
+ canApply.value = true;
}
- } else if(activePay.value == 0){
- button.value = canApply ? '免费加入' : '去相亲';
- } else {
- button.value = '立即加入';
}
+
+ button.value = canApply.value ? '立即申请' : '条件不满足';
// 实习红娘
- if(roseList[activePay.value].subCategory == 88804){
+ if(roseList[activePay.value].type == 1){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
- } else if(roseList[activePay.value].subCategory == 88803){
+ } else if(roseList[activePay.value].type == 2){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
{'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
];
- } else if(roseList[activePay.value].subCategory == 88802){
- revenue.value = [
- {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
- // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
- {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
- {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
- ];
- } else if(roseList[activePay.value].subCategory == 88801){
+ } else if(roseList[activePay.value].type == 3){
revenue.value = [
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
@@ -80,85 +141,78 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
}
}
- // 倒计时秒数
- final countdownSeconds = 0.obs;
- @override
- void onInit() {
- super.onInit();
- WidgetsBinding.instance.addObserver(this);
- _userApi = Get.find();
- if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
- matchmakerFlag.value = true;
- }
- initDataList();
- }
-
- @override
- void didChangeAppLifecycleState(AppLifecycleState state) {
- if(state == AppLifecycleState.resumed){
- if (countdownSeconds.value > 0) {
- startCountdown();
- }
- }
- }
+ // @override
+ // void didChangeAppLifecycleState(AppLifecycleState state) {
+ // if(state == AppLifecycleState.resumed){
+ // if (countdownSeconds.value > 0) {
+ // startCountdown();
+ // }
+ // }
+ // }
// 开始倒计时
- void startCountdown() async {
- try{
- bool audit = false;
- if(matchmakerFlag.value){
- // 如果是红娘,那么就要检测支付单是否支付成功,
-
- } else {
- // 如果是不是红娘,那么就要检测用户是否变成了红娘,
- final response = await _userApi.getAuditMatchmaker();
- if (response.data.isSuccess && response.data.data != null) {
- audit = response.data.data['needAudit'];
- }
- }
- if(audit){
- Future.delayed(const Duration(milliseconds: 300), () {
- if (countdownSeconds.value > 0) {
- countdownSeconds.value--;
- startCountdown();
- }
- });
- } else {
- countdownSeconds.value = 0;
- GlobalData().userData!.matchmakerFlag = true;
- GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory;
- Get.back(result: 1);
- }
- } catch (e) {
- print('87$e');
- }
- }
+ // void startCountdown() async {
+ // try{
+ // bool audit = false;
+ // if(matchmakerFlag.value){
+ // // 如果是红娘,那么就要检测支付单是否支付成功,
+ //
+ // } else {
+ // // 如果是不是红娘,那么就要检测用户是否变成了红娘,
+ // final response = await _userApi.getAuditMatchmaker();
+ // if (response.data.isSuccess && response.data.data != null) {
+ // audit = response.data.data['needAudit'];
+ // }
+ // }
+ // if(audit){
+ // Future.delayed(const Duration(milliseconds: 300), () {
+ // if (countdownSeconds.value > 0) {
+ // countdownSeconds.value--;
+ // startCountdown();
+ // }
+ // });
+ // } else {
+ // countdownSeconds.value = 0;
+ // GlobalData().userData!.matchmakerFlag = true;
+ // GlobalData().userData!.matchmakerType = roseList[activePay.value].type;
+ // Get.back(result: 1);
+ // }
+ // } catch (e) {
+ // print('87$e');
+ // }
+ // }
@override
void onClose() {
- WidgetsBinding.instance.removeObserver(this);
+ // WidgetsBinding.instance.removeObserver(this);
super.onClose();
}
initDataList() async {
try{
- final result = await _userApi.getMatchmakerFee();
+ loading.value = true;
+ final result = await _userApi.getMatchmakerRequirement();
if (result.data.isSuccess && result.data.data != null) {
- roseList.value = result.data.data!.records;
+ roseList.value = result.data.data!;
}
final response = await _userApi.getChatStaticsInfo();
if (response.data.isSuccess && response.data.data != null) {
- final data = response.data.data!;
+ consumption.value = response.data.data!;
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;
+ int hours = roseList[activePay.value].liveDurationHours!;
+ int rose = roseList[activePay.value].liveConsumptionAmount!;
+ if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
+ if(rose <= 0){
+ canApply.value = true;
+ } else if(consumption.value.liveConsumptionAmount! >= rose){
+ canApply.value = true;
+ }
}
}
}
if(matchmakerFlag.value){
- final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!);
+ final index = roseList.indexWhere((item) => item.type == GlobalData().userData!.matchmakerType!);
enableIndex.value = index >= 0 ? index : 0;
changePayActive(enableIndex.value);
} else {
@@ -166,57 +220,26 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
}
} catch (e) {
print('spread: $e');
+ } finally {
+ loading.value = false;
}
}
submitOrder() async {
- if(activePay.value == 0 && !canApply){
- Get.back();
+ if(!canApply.value){
return;
}
try {
- var matchmakerOrderType = 1;
- var matchmakerType = roseList[activePay.value].subCategory;
- if(GlobalData().userData!.matchmakerFlag!){
- if(matchmakerType != GlobalData().userData!.matchmakerType){
- matchmakerOrderType = 2;
- } else {
- matchmakerOrderType = 3;
- }
- } else {
- await _userApi.applyMatchmaker({
- "phone": GlobalData().userData!.phone,
- "name": GlobalData().userData!.name
- });
- }
- final response = await _userApi.submitMatchmakerOrder({
- "productSpecId": roseList[activePay.value].productSpecId,
- "matchmakerOrderType": matchmakerOrderType
+ final response = await _userApi.applyLiveMatchmaker({
+ "behavior": GlobalData().userData!.matchmakerFlag! ? 2 : 1,
+ "type": roseList[activePay.value].type
});
- if (response.data.isSuccess && response.data.data != null) {
- final data = response.data.data;
-
- if(data!.freeSettlement!){
- SmartDialog.showToast('加入成功');
- GlobalData().userData!.matchmakerFlag = true;
- GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory;
- Get.back(result: 1);
- } else {
- paymentOrderId = data.paymentOrderId!;
- 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 ?? '网络异常');
+ if (response.data.isSuccess) {
+ SmartDialog.showToast('申请成功,请等待审核');
+ Get.back();
}
} catch (e) {
- SmartDialog.showToast('下单失败');
+ SmartDialog.showToast('申请失败');
}
}
diff --git a/lib/controller/setting/task_controller.dart b/lib/controller/setting/task_controller.dart
index b3b3711..0461c49 100644
--- a/lib/controller/setting/task_controller.dart
+++ b/lib/controller/setting/task_controller.dart
@@ -1,9 +1,6 @@
-import 'package:dating_touchme_app/controller/global.dart';
-import 'package:dating_touchme_app/model/mine/chat_static_data.dart';
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/network/user_api.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
-import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
class TaskController extends GetxController {
@@ -11,135 +8,30 @@ class TaskController extends GetxController {
// UserApi实例
late UserApi _userApi;
final roseList = [].obs;
-
- final roseNum = 0.obs;
-
- final payChecked = true.obs;
-
- final activePay = 0.obs;
- final enableIndex = (-1).obs;
- final Fluwx fluwx = Fluwx();
- final matchmakerFlag = false.obs;
- final button = '立即申请'.obs;
- final canApply = false.obs;
- String paymentOrderId = '';
- final revenue = [
- {'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
- {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
- {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
- {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
- ].obs;
- final userData = GlobalData().userData.obs;
- final userId = GlobalData().userId.obs;
-
- final consumption = ChatStaticData().obs;
- final countdownSeconds = 0.obs;
+ final loading = true.obs;
@override
void onInit() {
super.onInit();
_userApi = Get.find();
- if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
- matchmakerFlag.value = true;
- }
initDataList();
}
- changePayActive(int index){
- if(index < enableIndex.value && enableIndex.value >= 0){
- return;
- }
- activePay.value = index;
- canApply.value = false;
- int hours = roseList[activePay.value].liveDurationHours!;
- int rose = roseList[activePay.value].liveConsumptionAmount!;
- if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
- if(rose <= 0){
- canApply.value = true;
- } else if(consumption.value.liveConsumptionAmount! >= rose){
- canApply.value = true;
- }
- }
-
- button.value = canApply.value ? '立即申请' : '条件不满足';
- // 实习红娘
- if(roseList[activePay.value].type == 1){
- revenue.value = [
- {'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'},
- {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
- {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
- {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
- ];
- } else if(roseList[activePay.value].type == 2){
- revenue.value = [
- {'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'},
- {'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'},
- {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
- {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
- ];
- } else if(roseList[activePay.value].type == 3){
- revenue.value = [
- {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'},
- // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'},
- {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'},
- {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'},
- ];
- }
-
- }
-
- @override
- void onClose() {
- // WidgetsBinding.instance.removeObserver(this);
- super.onClose();
- }
-
initDataList() async {
try{
+ loading.value = true;
final result = await _userApi.getMatchmakerRequirement();
if (result.data.isSuccess && result.data.data != null) {
roseList.value = result.data.data!;
}
- final response = await _userApi.getChatStaticsInfo();
- if (response.data.isSuccess && response.data.data != null) {
- consumption.value = response.data.data!;
- if(roseList[activePay.value].liveDurationHours != null){
- int hours = roseList[activePay.value].liveDurationHours!;
- int rose = roseList[activePay.value].liveConsumptionAmount!;
- if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){
- if(rose <= 0){
- canApply.value = true;
- } else if(consumption.value.liveConsumptionAmount! >= rose){
- canApply.value = true;
- }
- }
- }
- }
- if(matchmakerFlag.value){
- final index = roseList.indexWhere((item) => item.type == GlobalData().userData!.matchmakerType!);
- enableIndex.value = index >= 0 ? index : 0;
- changePayActive(enableIndex.value);
- } else {
- changePayActive(0);
- }
- } catch (e) {
- print('spread: $e');
+ } finally {
+ loading.value = false;
}
}
submitOrder() async {
- if(!canApply.value){
- return;
- }
try {
- final response = await _userApi.applyLiveMatchmaker({
- "behavior": GlobalData().userData!.matchmakerFlag! ? 2 : 1,
- "type": roseList[activePay.value].type
- });
- if (response.data.isSuccess) {
- SmartDialog.showToast('申请成功,请等待审核');
- Get.back();
- }
+
} catch (e) {
SmartDialog.showToast('申请失败');
}
diff --git a/lib/model/mine/chat_static_data.dart b/lib/model/mine/chat_static_data.dart
index 8982190..3bbf42e 100644
--- a/lib/model/mine/chat_static_data.dart
+++ b/lib/model/mine/chat_static_data.dart
@@ -1,16 +1,18 @@
// 登录响应实体类
class ChatStaticData {
- final int id;
- final int liveDurationMins;
- final int todayCrossMicCount;
+ int? id;
+ int? liveDurationMins;
+ int? liveConsumptionAmount;
+ int? todayCrossMicCount;
- ChatStaticData({required this.id, required this.liveDurationMins, required this.todayCrossMicCount});
+ ChatStaticData({this.id, this.liveDurationMins, this.todayCrossMicCount, this.liveConsumptionAmount});
// 从JSON映射创建实例
factory ChatStaticData.fromJson(Map json) {
return ChatStaticData(
id: json['id'] ?? '',
liveDurationMins: json['liveDurationMins'] ?? 0,
+ liveConsumptionAmount: json['liveConsumptionAmount'] ?? 0,
todayCrossMicCount: json['todayCrossMicCount'] ?? 0,
);
}
@@ -21,11 +23,13 @@ class ChatStaticData {
'id': id,
'liveDurationMins': liveDurationMins,
'todayCrossMicCount': todayCrossMicCount,
+ 'liveConsumptionAmount': liveConsumptionAmount,
};
}
@override
String toString() {
- return 'LoginData(id: $id, liveDurationMins: $liveDurationMins)';
+ return 'LoginData(id: $id, liveDurationMins: $liveDurationMins, liveConsumptionAmount: $liveConsumptionAmount)';
}
+
}
\ No newline at end of file
diff --git a/lib/model/mine/user_base_data.dart b/lib/model/mine/user_base_data.dart
index a75673c..febedcf 100644
--- a/lib/model/mine/user_base_data.dart
+++ b/lib/model/mine/user_base_data.dart
@@ -1,3 +1,40 @@
+class LiveMatchmaker {
+ final String? userId;
+ final String? remark;
+ final String? id;
+ final bool? enable;
+ final int? type;
+
+ LiveMatchmaker({
+ this.userId,
+ this.remark,
+ this.id,
+ this.enable,
+ this.type,
+ });
+
+ factory LiveMatchmaker.fromJson(Map json) {
+ return LiveMatchmaker(
+ userId: json['userId'] as String?,
+ remark: json['remark'] as String?,
+ id: json['id'] as String?,
+ enable: json['enable'] as bool?,
+ type: json['type'] as int?,
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'userId': userId,
+ 'remark': remark,
+ 'id': id,
+ 'enable': enable,
+ 'type': type,
+ };
+ }
+}
+
+
// 用户基础信息实体类
class UserBaseData {
final bool matchmakerFlag;
@@ -6,9 +43,11 @@ class UserBaseData {
final String phone;
final String realName;
final String userId;
+ final LiveMatchmaker? liveMatchmaker;
final int matchmakerType;
final bool? isOnline; // 在线状态
+
UserBaseData({
required this.matchmakerFlag,
required this.matchmakingCornerFlag,
@@ -17,6 +56,7 @@ class UserBaseData {
required this.realName,
required this.userId,
required this.matchmakerType,
+ this.liveMatchmaker,
this.isOnline,
});
@@ -30,6 +70,7 @@ class UserBaseData {
phone: json['phone'] ?? '',
realName: json['realName'] ?? '',
userId: json['userId'] ?? '',
+ liveMatchmaker: json['liveMatchmaker'] != null ? LiveMatchmaker.fromJson(json['liveMatchmaker'] as Map) : null,
isOnline: json['isOnline'] as bool?,
);
}
@@ -44,6 +85,7 @@ class UserBaseData {
'phone': phone,
'realName': realName,
'userId': userId,
+ 'liveMatchmaker': liveMatchmaker?.toJson(),
'isOnline': isOnline,
};
}
diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart
index b0f62c6..2883f48 100644
--- a/lib/network/api_urls.dart
+++ b/lib/network/api_urls.dart
@@ -113,6 +113,9 @@ class ApiUrls {
static const String listMatchmakerProduct =
'dating-agency-mall/user/page/product/by/matchmaker';
+ static const String listMatchmakerRequirement =
+ 'dating-agency-uec/user/list/live-matchmaker-apply-requirement';
+
static const String auditMatchmakerResult =
'dating-agency-uec/user/need-audit/matchmaker-audit';
@@ -152,4 +155,7 @@ class ApiUrls {
static const String consumeOneOnOneRtcChannel =
'dating-agency-chat-audio/user/consume/one-on-one/rtc-channel';
+ static const String applyLiveMatchmaker =
+ 'dating-agency-uec/user/apply/live-matchmaker';
+
}
diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart
index a547459..b58c3e2 100644
--- a/lib/network/user_api.dart
+++ b/lib/network/user_api.dart
@@ -6,6 +6,7 @@ import 'package:dating_touchme_app/model/mine/education_data.dart';
import 'package:dating_touchme_app/model/mine/friend_apply_data.dart';
import 'package:dating_touchme_app/model/mine/friend_data.dart';
import 'package:dating_touchme_app/model/mine/login_data.dart';
+import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart';
import 'package:dating_touchme_app/model/mine/occupation_data.dart';
import 'package:dating_touchme_app/model/mine/payment_detail_data.dart';
import 'package:dating_touchme_app/model/mine/rose_data.dart';
@@ -203,6 +204,9 @@ abstract class UserApi {
@GET(ApiUrls.listMatchmakerProduct)
Future>>> getMatchmakerFee();
+ @GET(ApiUrls.listMatchmakerRequirement)
+ Future>>> getMatchmakerRequirement();
+
@GET(ApiUrls.auditMatchmakerResult)
Future>> getAuditMatchmaker();
@@ -276,4 +280,9 @@ abstract class UserApi {
@Query('versionCode') required int code,
});
+ @POST(ApiUrls.applyLiveMatchmaker)
+ Future>> applyLiveMatchmaker(
+ @Body() Map data,
+ );
+
}
diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart
index 095ff32..5eee020 100644
--- a/lib/network/user_api.g.dart
+++ b/lib/network/user_api.g.dart
@@ -1204,6 +1204,49 @@ class _UserApi implements UserApi {
return httpResponse;
}
+ @override
+ Future>>>
+ getMatchmakerRequirement() 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-uec/user/list/live-matchmaker-apply-requirement',
+ queryParameters: queryParameters,
+ data: _data,
+ )
+ .copyWith(
+ baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl),
+ ),
+ );
+ final _result = await _dio.fetch