This commit is contained in:
2025-12-04 13:37:11 +08:00
parent f770f8055e
commit b216ddaa61
11 changed files with 377 additions and 10 deletions

View File

@@ -10,9 +10,26 @@
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{
@"userId": @[@"uid"],
@"gender": @[@"gender", @"sex"],
};
}
+ (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property {
if ([property.name isEqualToString:@"gender"]) {
if ([oldValue isKindOfClass:[NSNumber class]]) {
NSInteger intValue = [(NSNumber *)oldValue integerValue];
if (intValue >= UserSexTwoSex && intValue <= UserSexMan) {
return @(intValue);
} else {
//
KBLOG(@"⚠️ 收到非法的userStatus值: %ld", (long)intValue);
return @(UserSexMan);
}
}
return @(UserSexMan);
}
return oldValue;
}
@end