diff --git a/lib/model/mine/user_base_data.dart b/lib/model/mine/user_base_data.dart new file mode 100644 index 0000000..d6b1508 --- /dev/null +++ b/lib/model/mine/user_base_data.dart @@ -0,0 +1,47 @@ +// 用户基础信息实体类 +class UserBaseData { + final bool matchmakerFlag; + final bool matchmakingCornerFlag; + final String nickName; + final String phone; + final String realName; + final String userId; + + UserBaseData({ + required this.matchmakerFlag, + required this.matchmakingCornerFlag, + required this.nickName, + required this.phone, + required this.realName, + required this.userId, + }); + + // 从JSON映射创建实例 + factory UserBaseData.fromJson(Map json) { + return UserBaseData( + matchmakerFlag: json['matchmakerFlag'] ?? false, + matchmakingCornerFlag: json['matchmakingCornerFlag'] ?? false, + nickName: json['nickName'] ?? '', + phone: json['phone'] ?? '', + realName: json['realName'] ?? '', + userId: json['userId'] ?? '', + ); + } + + // 转换为JSON映射 + Map toJson() { + return { + 'matchmakerFlag': matchmakerFlag, + 'matchmakingCornerFlag': matchmakingCornerFlag, + 'nickName': nickName, + 'phone': phone, + 'realName': realName, + 'userId': userId, + }; + } + + @override + String toString() { + return 'UserBaseData(matchmakerFlag: $matchmakerFlag, matchmakingCornerFlag: $matchmakingCornerFlag, nickName: $nickName, phone: $phone, realName: $realName, userId: $userId)'; + } +} \ No newline at end of file diff --git a/lib/model/mine/user_data.dart b/lib/model/mine/user_data.dart new file mode 100644 index 0000000..fc2fa39 --- /dev/null +++ b/lib/model/mine/user_data.dart @@ -0,0 +1,259 @@ +// 用户详细信息实体类 +class UserData { + final String id; + final String nickName; + final String? name; + final String? profilePhoto; + final String? identityCard; + final int genderCode; + final String genderValue; + final String? homeCountryCode; + final String? homeCountry; + final String? provinceCode; + final String? provinceName; + final String? cityCode; + final String? cityName; + final String? districtCode; + final String? districtName; + final String? birthYear; + final String? birthDate; + final String? constellationCode; + final String? constellation; + final String? chineseZodiacCode; + final String? chineseZodiac; + final String? height; + final String? weight; + final int? educationCode; + final String? education; + final String? maritalStatusCode; + final String? maritalStatusName; + final String? minimumIncome; + final String? maximumIncome; + final String? incomeCode; + final String? income; + final String? describeInfo; + final String? domicilePlaceProvinceCode; + final String? domicilePlaceProvinceName; + final String? domicilePlaceCityCode; + final String? domicilePlaceCityName; + final String? nationCode; + final String? nation; + final String? bodilyFormCode; + final String? bodilyForm; + final String? accountTypeCode; + final String? accountTypeName; + final String? nationalityCode; + final String? nationality; + final String? nativePlaceCode; + final String? nativePlaceName; + final String? industryCode; + final String? industry; + final String? occupationCode; + final String? occupation; + final String? onlyChild; + final String? carPurchaseSituationCode; + final String? carPurchaseSituation; + final String? propertyPermitsCode; + final String? propertyPermits; + final String? hometownProvinceCode; + final String? hometownProvinceName; + final String? hometownCityCode; + final String? hometownCityName; + + UserData({ + required this.id, + required this.nickName, + this.name, + this.profilePhoto, + this.identityCard, + required this.genderCode, + required this.genderValue, + this.homeCountryCode, + this.homeCountry, + this.provinceCode, + this.provinceName, + this.cityCode, + this.cityName, + this.districtCode, + this.districtName, + this.birthYear, + this.birthDate, + this.constellationCode, + this.constellation, + this.chineseZodiacCode, + this.chineseZodiac, + this.height, + this.weight, + this.educationCode, + this.education, + this.maritalStatusCode, + this.maritalStatusName, + this.minimumIncome, + this.maximumIncome, + this.incomeCode, + this.income, + this.describeInfo, + this.domicilePlaceProvinceCode, + this.domicilePlaceProvinceName, + this.domicilePlaceCityCode, + this.domicilePlaceCityName, + this.nationCode, + this.nation, + this.bodilyFormCode, + this.bodilyForm, + this.accountTypeCode, + this.accountTypeName, + this.nationalityCode, + this.nationality, + this.nativePlaceCode, + this.nativePlaceName, + this.industryCode, + this.industry, + this.occupationCode, + this.occupation, + this.onlyChild, + this.carPurchaseSituationCode, + this.carPurchaseSituation, + this.propertyPermitsCode, + this.propertyPermits, + this.hometownProvinceCode, + this.hometownProvinceName, + this.hometownCityCode, + this.hometownCityName, + }); + + // 从JSON映射创建实例 + factory UserData.fromJson(Map json) { + return UserData( + id: json['id'] ?? '', + nickName: json['nickName'] ?? '', + name: json['name'], + profilePhoto: json['profilePhoto'], + identityCard: json['identityCard'], + genderCode: json['genderCode'] ?? 0, + genderValue: json['genderValue'] ?? '', + homeCountryCode: json['homeCountryCode'], + homeCountry: json['homeCountry'], + provinceCode: json['provinceCode'], + provinceName: json['provinceName'], + cityCode: json['cityCode'], + cityName: json['cityName'], + districtCode: json['districtCode'], + districtName: json['districtName'], + birthYear: json['birthYear'], + birthDate: json['birthDate'], + constellationCode: json['constellationCode'], + constellation: json['constellation'], + chineseZodiacCode: json['chineseZodiacCode'], + chineseZodiac: json['chineseZodiac'], + height: json['height'], + weight: json['weight'], + educationCode: json['educationCode'], + education: json['education'], + maritalStatusCode: json['maritalStatusCode'], + maritalStatusName: json['maritalStatusName'], + minimumIncome: json['minimumIncome'], + maximumIncome: json['maximumIncome'], + incomeCode: json['incomeCode'], + income: json['income'], + describeInfo: json['describeInfo'], + domicilePlaceProvinceCode: json['domicilePlaceProvinceCode'], + domicilePlaceProvinceName: json['domicilePlaceProvinceName'], + domicilePlaceCityCode: json['domicilePlaceCityCode'], + domicilePlaceCityName: json['domicilePlaceCityName'], + nationCode: json['nationCode'], + nation: json['nation'], + bodilyFormCode: json['bodilyFormCode'], + bodilyForm: json['bodilyForm'], + accountTypeCode: json['accountTypeCode'], + accountTypeName: json['accountTypeName'], + nationalityCode: json['nationalityCode'], + nationality: json['nationality'], + nativePlaceCode: json['nativePlaceCode'], + nativePlaceName: json['nativePlaceName'], + industryCode: json['industryCode'], + industry: json['industry'], + occupationCode: json['occupationCode'], + occupation: json['occupation'], + onlyChild: json['onlyChild'], + carPurchaseSituationCode: json['carPurchaseSituationCode'], + carPurchaseSituation: json['carPurchaseSituation'], + propertyPermitsCode: json['propertyPermitsCode'], + propertyPermits: json['propertyPermits'], + hometownProvinceCode: json['hometownProvinceCode'], + hometownProvinceName: json['hometownProvinceName'], + hometownCityCode: json['hometownCityCode'], + hometownCityName: json['hometownCityName'], + ); + } + + // 转换为JSON映射 + Map toJson() { + return { + 'id': id, + 'nickName': nickName, + 'name': name, + 'profilePhoto': profilePhoto, + 'identityCard': identityCard, + 'genderCode': genderCode, + 'genderValue': genderValue, + 'homeCountryCode': homeCountryCode, + 'homeCountry': homeCountry, + 'provinceCode': provinceCode, + 'provinceName': provinceName, + 'cityCode': cityCode, + 'cityName': cityName, + 'districtCode': districtCode, + 'districtName': districtName, + 'birthYear': birthYear, + 'birthDate': birthDate, + 'constellationCode': constellationCode, + 'constellation': constellation, + 'chineseZodiacCode': chineseZodiacCode, + 'chineseZodiac': chineseZodiac, + 'height': height, + 'weight': weight, + 'educationCode': educationCode, + 'education': education, + 'maritalStatusCode': maritalStatusCode, + 'maritalStatusName': maritalStatusName, + 'minimumIncome': minimumIncome, + 'maximumIncome': maximumIncome, + 'incomeCode': incomeCode, + 'income': income, + 'describeInfo': describeInfo, + 'domicilePlaceProvinceCode': domicilePlaceProvinceCode, + 'domicilePlaceProvinceName': domicilePlaceProvinceName, + 'domicilePlaceCityCode': domicilePlaceCityCode, + 'domicilePlaceCityName': domicilePlaceCityName, + 'nationCode': nationCode, + 'nation': nation, + 'bodilyFormCode': bodilyFormCode, + 'bodilyForm': bodilyForm, + 'accountTypeCode': accountTypeCode, + 'accountTypeName': accountTypeName, + 'nationalityCode': nationalityCode, + 'nationality': nationality, + 'nativePlaceCode': nativePlaceCode, + 'nativePlaceName': nativePlaceName, + 'industryCode': industryCode, + 'industry': industry, + 'occupationCode': occupationCode, + 'occupation': occupation, + 'onlyChild': onlyChild, + 'carPurchaseSituationCode': carPurchaseSituationCode, + 'carPurchaseSituation': carPurchaseSituation, + 'propertyPermitsCode': propertyPermitsCode, + 'propertyPermits': propertyPermits, + 'hometownProvinceCode': hometownProvinceCode, + 'hometownProvinceName': hometownProvinceName, + 'hometownCityCode': hometownCityCode, + 'hometownCityName': hometownCityName, + }; + } + + @override + String toString() { + return 'UserData(id: $id, nickName: $nickName, genderCode: $genderCode, genderValue: $genderValue, birthYear: $birthYear)'; + } +} \ No newline at end of file diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index 35bb873..6c0efd8 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -7,6 +7,7 @@ class ApiUrls { // 用户相关接口 static const String getBaseUserInfo = 'dating-agency-uec/user/get/base-info'; + static const String getMarriageInformationDetail = 'dating-agency-service/user/get/dongwo/marriage-information-detail'; // 后续可以在此添加更多API端点 } \ No newline at end of file diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index 20e7c48..04a78af 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -1,5 +1,6 @@ import 'package:dating_touchme_app/model/mine/login_data.dart'; import 'package:dating_touchme_app/model/mine/user_base_data.dart'; +import 'package:dating_touchme_app/model/mine/user_data.dart'; import 'package:dating_touchme_app/network/response_model.dart'; import 'package:dating_touchme_app/network/api_urls.dart'; import 'package:retrofit/retrofit.dart'; @@ -20,6 +21,9 @@ abstract class UserApi { Future>> getBaseUserInfo( @Query('userId') String userId, ); + + @GET(ApiUrls.getMarriageInformationDetail) + Future>> getMarriageInformationDetail(); @POST(ApiUrls.getVerificationCode) Future>> getVerificationCode( diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index c9c5021..eb29b46 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -86,6 +86,38 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> + getMarriageInformationDetail() 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-service/user/get/dongwo/marriage-information-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) => UserData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + @override Future>> getVerificationCode( Map data, diff --git a/lib/pages/mine/login_controller.dart b/lib/pages/mine/login_controller.dart index 618aac3..3fbe5da 100644 --- a/lib/pages/mine/login_controller.dart +++ b/lib/pages/mine/login_controller.dart @@ -135,13 +135,34 @@ class LoginController extends GetxController { final response = await _userApi.getBaseUserInfo(userId); if (response.data.isSuccess && response.data.data != null) { - // 可以在这里处理用户基础信息,比如更新UI状态 + // 成功获取基础信息后,调用获取婚姻信息详情接口 + await _getMarriageInformationDetail(); } else { SmartDialog.showToast(response.data.message); } } catch (e) { // 获取用户信息失败不影响登录流程 - // SmartDialog.showToast('获取用户信息失败'); + SmartDialog.showToast('获取用户信息失败'); + } + } + + // 获取用户婚姻信息详情 + Future _getMarriageInformationDetail() async { + try { + final response = await _userApi.getMarriageInformationDetail(); + + if (response.data.isSuccess) { + SmartDialog.showToast('跳转到完善信息'); + // 可以在这里处理用户婚姻信息详情,比如更新UI状态或保存到存储中 + if(response.data.data == null){ + //跳转到完善信息 + SmartDialog.showToast('跳转到完善信息'); + } + } else { + // 获取婚姻信息失败不影响登录流程 + } + } catch (e) { + // 获取婚姻信息失败不影响登录流程 } } } \ No newline at end of file