Batman 4 months ago
parent
commit
4a3dc327a1
6 changed files with 366 additions and 2 deletions
  1. 47
      lib/model/mine/user_base_data.dart
  2. 259
      lib/model/mine/user_data.dart
  3. 1
      lib/network/api_urls.dart
  4. 4
      lib/network/user_api.dart
  5. 32
      lib/network/user_api.g.dart
  6. 25
      lib/pages/mine/login_controller.dart

47
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<String, dynamic> 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<String, dynamic> 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)';
}
}

259
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<String, dynamic> 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<String, dynamic> 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)';
}
}

1
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端点
}

4
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<HttpResponse<BaseResponse<UserBaseData>>> getBaseUserInfo(
@Query('userId') String userId,
);
@GET(ApiUrls.getMarriageInformationDetail)
Future<HttpResponse<BaseResponse<UserData>>> getMarriageInformationDetail();
@POST(ApiUrls.getVerificationCode)
Future<HttpResponse<BaseResponse<dynamic>>> getVerificationCode(

32
lib/network/user_api.g.dart

@ -86,6 +86,38 @@ class _UserApi implements UserApi {
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<UserData>>>
getMarriageInformationDetail() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<HttpResponse<BaseResponse<UserData>>>(
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<Map<String, dynamic>>(_options);
late BaseResponse<UserData> _value;
try {
_value = BaseResponse<UserData>.fromJson(
_result.data!,
(json) => UserData.fromJson(json as Map<String, dynamic>),
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> getVerificationCode(
Map<String, dynamic> data,

25
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<void> _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) {
//
}
}
}
Loading…
Cancel
Save