From cbc7cf3e3ede174679094dce0640da5b1e08b06d Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Wed, 13 Dec 2023 15:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84UI=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DingDangApp.xcodeproj/project.pbxproj | 24 ++ .../DingDangApp/BsaseClass/Tool/ToolsObject.m | 2 +- .../CodeClass/Main/Model/AppUserModel.h | 15 + .../MyInfo/CC/DDMyBlackListViewController.m | 1 + .../MyInfo/CC/DDMyInfoSettingViewController.m | 31 +-- .../DDMyInformationGiftWallViewController.m | 26 +- .../CC/DDMyInformationProfileViewController.h | 4 +- .../CC/DDMyInformationProfileViewController.m | 83 +++++- .../MyInfo/CC/DDMyInformationViewController.m | 26 +- .../CodeClass/MyInfo/MM/DDGiftWallModel.h | 12 + .../VV/DDMyInfoGiftWallCollectionViewCell.m | 6 +- .../MyInfo/VV/DDMyInformationHeaderView.h | 5 +- .../MyInfo/VV/DDMyInformationHeaderView.m | 26 +- .../CodeClass/MyInfo/我的钱包/DDMyWalletVC.m | 18 +- .../MyInfo/我的钱包/DDMyWalletVC.xib | 6 +- .../MyInfo/我的钱包/Model/DDExchangeModel.h | 7 + yinmeng-ios/DingDangApp/PrefixHeader.pch | 1 + .../DingDangApp/V2Versions/Mine/DDMineVC.m | 25 +- .../Mine/MyRecharge/DDMyRechargeVC.m | 165 ++++++++++- .../Mine/MyRecharge/View/DDMyRechargeCell.m | 8 +- .../MyRecharge/View/DDMyRechargeHeaderView.m | 2 +- .../Mine/装饰商城/Cell/DDShoppingCell.m | 12 +- .../Mine/装饰商城/Cell/DDShoppingHeaderCell.m | 4 +- .../V2Versions/Mine/装饰商城/DDShoppingVC.m | 44 ++- .../Mine/装饰商城/Model/DDShoppingModel.h | 29 ++ .../DDMain/DDApplePay/DDApplePayManager.swift | 261 ++++++++++++++++++ .../DDApplePay/DingDangApp-Bridging-Header.h | 4 + .../DDMain/DDMine/DDMineApi/Api+DDMineApi.h | 5 + .../DDMain/DDMine/DDMineApi/Api+DDMineApi.m | 18 ++ 29 files changed, 776 insertions(+), 94 deletions(-) create mode 100644 yinmeng-ios/DingDangApp/YingMeng/DDMain/DDApplePay/DDApplePayManager.swift create mode 100644 yinmeng-ios/DingDangApp/YingMeng/DDMain/DDApplePay/DingDangApp-Bridging-Header.h diff --git a/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj b/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj index b32b75d..18cebb0 100644 --- a/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj +++ b/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj @@ -694,6 +694,7 @@ 18FDEDCF2A50353A005EB21D /* DynamicSendLocationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18FDEDCE2A50353A005EB21D /* DynamicSendLocationView.m */; }; 23A7F78B2B28795500288CAE /* Api+DDHomeApi.m in Sources */ = {isa = PBXBuildFile; fileRef = 23A7F7892B28795500288CAE /* Api+DDHomeApi.m */; }; 23A7F78F2B287E8C00288CAE /* Api+DDMineApi.m in Sources */ = {isa = PBXBuildFile; fileRef = 23A7F78E2B287E8C00288CAE /* Api+DDMineApi.m */; }; + 23A7F7932B29553E00288CAE /* DDApplePayManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23A7F7922B29553E00288CAE /* DDApplePayManager.swift */; }; 23B2A7B02B283A76001C0913 /* DDAppColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7622B283A75001C0913 /* DDAppColor.m */; }; 23B2A7B12B283A76001C0913 /* DDBaseVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7662B283A75001C0913 /* DDBaseVC.m */; }; 23B2A7B22B283A76001C0913 /* DDHUDManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7692B283A75001C0913 /* DDHUDManager.m */; }; @@ -2035,6 +2036,8 @@ 23A7F7892B28795500288CAE /* Api+DDHomeApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Api+DDHomeApi.m"; sourceTree = ""; }; 23A7F78D2B287E8C00288CAE /* Api+DDMineApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+DDMineApi.h"; sourceTree = ""; }; 23A7F78E2B287E8C00288CAE /* Api+DDMineApi.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+DDMineApi.m"; sourceTree = ""; }; + 23A7F7912B29553D00288CAE /* DingDangApp-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DingDangApp-Bridging-Header.h"; sourceTree = ""; }; + 23A7F7922B29553E00288CAE /* DDApplePayManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DDApplePayManager.swift; sourceTree = ""; }; 23B2A7622B283A75001C0913 /* DDAppColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDAppColor.m; sourceTree = ""; }; 23B2A7632B283A75001C0913 /* DDAppColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDAppColor.h; sourceTree = ""; }; 23B2A7652B283A75001C0913 /* DDBaseVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDBaseVC.h; sourceTree = ""; }; @@ -5157,6 +5160,15 @@ path = DDMineApi; sourceTree = ""; }; + 23A7F7902B29551D00288CAE /* DDApplePay */ = { + isa = PBXGroup; + children = ( + 23A7F7922B29553E00288CAE /* DDApplePayManager.swift */, + 23A7F7912B29553D00288CAE /* DingDangApp-Bridging-Header.h */, + ); + path = DDApplePay; + sourceTree = ""; + }; 23B2A7612B283A75001C0913 /* DDAppColor */ = { isa = PBXGroup; children = ( @@ -5460,6 +5472,7 @@ 23B2A8072B284A99001C0913 /* DDMain */ = { isa = PBXGroup; children = ( + 23A7F7902B29551D00288CAE /* DDApplePay */, 23A7F7862B28795500288CAE /* DDHome */, 23A7F78A2B28795500288CAE /* DDMine */, ); @@ -5910,6 +5923,7 @@ TargetAttributes = { ECA531332A20EB60006E6D04 = { CreatedOnToolsVersion = 14.2; + LastSwiftMigration = 1500; }; ECA5314E2A20EB64006E6D04 = { CreatedOnToolsVersion = 14.2; @@ -6763,6 +6777,7 @@ 1826C5E92A2431CA00A5AFDB /* DDCellModel.m in Sources */, 186A88E72A4152AA001DE99E /* DDMyLevelView.m in Sources */, 18F46D9D2A28409600CD2B7E /* RoomSendGiftTopView.m in Sources */, + 23A7F7932B29553E00288CAE /* DDApplePayManager.swift in Sources */, 18660D532A2193C50032D0C9 /* UIView+Common.m in Sources */, 18D348372A26144B0011D61C /* DDMyInfoSettingTableViewCell.m in Sources */, 186A890A2A4193B1001DE99E /* DDMyRoomHomeViewController.m in Sources */, @@ -7010,6 +7025,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = DingDangApp/DingDangApp.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; @@ -7053,6 +7069,9 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "DingDangApp/YingMeng/DDMain/DDApplePay/DingDangApp-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -7064,6 +7083,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = DingDangApp/DingDangApp.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; @@ -7107,6 +7127,8 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "DingDangApp/YingMeng/DDMain/DDApplePay/DingDangApp-Bridging-Header.h"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; @@ -7115,6 +7137,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D1D40500E156EDA751B2F2CE /* Pods-DingDangAppTests.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -7133,6 +7156,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 688E5912F2E950A95FC1EE55 /* Pods-DingDangAppTests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; diff --git a/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m b/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m index df912ac..6711c1a 100644 --- a/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m +++ b/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m @@ -876,7 +876,7 @@ static NSString *SAVEROOMCONFIG = @"ROOMCONFIG"; } + (void)pushMyInformationViewController:(NSString *)user_id{ DDMyInformationViewController * infoVC = [[DDMyInformationViewController alloc] init]; - infoVC.user_id = user_id; + infoVC.user_id = [[AccountInfoStorage instance]getUid];; [[ToolsObject getCurrentViewController].navigationController pushViewController:infoVC animated:YES]; } + (NSString*)dd_timeAfterTarget:(NSString *)changeTime diff --git a/yinmeng-ios/DingDangApp/CodeClass/Main/Model/AppUserModel.h b/yinmeng-ios/DingDangApp/CodeClass/Main/Model/AppUserModel.h index 4a95dce..7e1eb29 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Main/Model/AppUserModel.h +++ b/yinmeng-ios/DingDangApp/CodeClass/Main/Model/AppUserModel.h @@ -67,7 +67,22 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) NSString *invite_code; @property (nonatomic, copy) NSString *code; +/// 用户 uid +@property(nonatomic, assign) NSInteger uid; +/// 钻石数量 +@property(nonatomic, copy)NSString *goldNum; +//钻石数量 +@property(nonatomic, copy)NSString *diamonds; +@property(nonatomic, copy)NSString *chargeGoldNum; + +@property(nonatomic, assign)NSInteger amount; +/// 钻石数量 +@property(nonatomic, assign) double diamondNum; + +@property(nonatomic, copy)NSString *depositNum; +/// 是否有钻石转增功能 +@property (nonatomic, assign) BOOL sendGold; @end NS_ASSUME_NONNULL_END diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyBlackListViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyBlackListViewController.m index 5567d55..57f2a0a 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyBlackListViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyBlackListViewController.m @@ -64,6 +64,7 @@ } -(void)requestData { + return; NSMutableDictionary *requestDict = [NSMutableDictionary dictionary]; [requestDict setObject:@(20) forKey:@"current_page"]; [requestDict setObject:@(self.pageNum) forKey:@"page_number"]; diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoSettingViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoSettingViewController.m index 2297908..9f9c758 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoSettingViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoSettingViewController.m @@ -66,7 +66,6 @@ [DDCellModel addDataWithName:@"账号与安全" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_Account) content:@""], [DDCellModel addDataWithName:@"青少年模式" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_YoungMode) content:@""], [DDCellModel addDataWithName:@"黑名单" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_MyBlackList) content:@""], - [DDCellModel addDataWithName:@"联系我们" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_AboutUs) content:@""], [DDCellModel addDataWithName:@"隐私协议" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_PrivacyAgreement) content:@""], [DDCellModel addDataWithName:@"当前版本" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_CurrentVersion) content:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]], [DDCellModel addDataWithName:@"清除缓存" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_ClearCache) content:[NSString stringWithFormat:@"%.2fM",[self getAppCacheSize]]], @@ -174,20 +173,20 @@ } } }else if (model.setType == DDMyInfoModelType_Notification){ - WeakSelf(weakSelf) - [NetworkRequest requestPOST:@"/home/set/notification" parameters:@{} block:^(BaseResponse * _Nonnull response) { - if (response.code == 200) { - AppUserModel * model = [ToolsObject getUserModel]; - model.is_notification = !model.is_notification; - [ToolsObject saveUserModel:model]; - DDCellModel * cellModel = weakSelf.listArr[weakSelf.listArr.count-1]; - cellModel.content = [NSString stringWithFormat:@"%d",[ToolsObject getUserModel].is_notification]; - dispatch_async(dispatch_get_main_queue(), ^{ - NSIndexPath *index = [NSIndexPath indexPathForRow:weakSelf.listArr.count-1 inSection:0]; - [weakSelf.myTableView reloadRowsAtIndexPaths:@[index] withRowAnimation:(UITableViewRowAnimationNone)]; - }); - } - }]; +// WeakSelf(weakSelf) +// [NetworkRequest requestPOST:@"/home/set/notification" parameters:@{} block:^(BaseResponse * _Nonnull response) { +// if (response.code == 200) { +// AppUserModel * model = [ToolsObject getUserModel]; +// model.is_notification = !model.is_notification; +// [ToolsObject saveUserModel:model]; +// DDCellModel * cellModel = weakSelf.listArr[weakSelf.listArr.count-1]; +// cellModel.content = [NSString stringWithFormat:@"%d",[ToolsObject getUserModel].is_notification]; +// dispatch_async(dispatch_get_main_queue(), ^{ +// NSIndexPath *index = [NSIndexPath indexPathForRow:weakSelf.listArr.count-1 inSection:0]; +// [weakSelf.myTableView reloadRowsAtIndexPaths:@[index] withRowAnimation:(UITableViewRowAnimationNone)]; +// }); +// } +// }]; }else{} }; @@ -234,7 +233,7 @@ case DDMyInfoModelType_PrivacyAgreement: { /* 隐私协议 */ - DDWebViewController * webVC = [DDWebViewController webControlerWithUrlStr:[NSString stringWithFormat:@"%@#/publicpage?position=1009",KWebURL] isShowNavBar:YES navTitle:@"隐私协议"]; + DDWebViewController * webVC = [DDWebViewController webControlerWithUrlStr:[NSString stringWithFormat:@"%@/yinmeng/modules/rule/privacy-wap.html",API_HOST_H5_URL] isShowNavBar:YES navTitle:@"隐私协议"]; webVC.view.backgroundColor = UIColor.whiteColor; [[ToolsObject getCurrentViewController].navigationController pushViewController:webVC animated:NO]; } diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationGiftWallViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationGiftWallViewController.m index 175a1b2..fde1868 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationGiftWallViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationGiftWallViewController.m @@ -9,6 +9,7 @@ #import "DDMyInfoGiftWallView.h" #import "DDMyInfoGiftWallCollectionViewCell.h" #import "DDGiftWallModel.h" +#import "Api+DDMineApi.h" @interface DDMyInformationGiftWallViewController () @end @@ -29,6 +30,29 @@ -(void)requestGiftWall { + WeakSelf(weakSelf) + [Api getUserGiftWall:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + [weakSelf.giftWallCollectionView.mj_header endRefreshing]; + [weakSelf.giftWallCollectionView.mj_footer endRefreshing]; + if(code == 200){ + if (weakSelf.pageNum == 1) { + [weakSelf.giftListArr removeAllObjects]; + } + NSArray *list = [DDGiftWallModel DD_ModelsWithArray:data.data]; + [weakSelf.giftListArr addObjectsFromArray:list]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.giftWallCollectionView.mj_header endRefreshing]; + [weakSelf.giftWallCollectionView.mj_footer endRefreshing]; + [weakSelf.giftWallCollectionView reloadData]; + + weakSelf.giftCount =list.count; + + + }); + } + } uid:self.user_id giftType:@"1"]; + + return; NSMutableDictionary *requestDict = [NSMutableDictionary dictionary]; if ([ToolsObject IsNullWithObject:self.user_id]) { [requestDict setObject:[ToolsObject getUserModel].user_id forKey:@"user_id"]; @@ -37,7 +61,7 @@ } [requestDict setObject:@(self.pageNum) forKey:@"page_number"]; [requestDict setObject:@(15) forKey:@"current_page"]; - WeakSelf(weakSelf) + [NetworkRequest requestPOST:@"/my/gift/list" parameters:requestDict block:^(BaseResponse * _Nonnull response) { if (response.code == 200) { if ([ToolsObject IsNullWithObject:response.data]) { diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.h b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.h index 3937589..edc6ce5 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.h +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.h @@ -6,7 +6,7 @@ // #import "DDBasePagerHomeListViewController.h" - +#import "UserInfoModel.h" NS_ASSUME_NONNULL_BEGIN @interface DDMyInformationProfileViewController : DDBasePagerHomeListViewController @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) UILabel * titleLabel; @property (nonatomic,strong) UILabel * myContentLabel; @property (nonatomic,copy) NSString * user_id; -@property (nonatomic,strong) AppUserModel * personModel; +@property (nonatomic,strong) UserInfoModel * personModel; @end NS_ASSUME_NONNULL_END diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.m index 2894861..17092e4 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationProfileViewController.m @@ -124,22 +124,91 @@ }]; } - (void)myIDBtnClick{ - if (![ToolsObject IsNullWithObject:self.personModel.user_number]) { + if (![ToolsObject IsNullWithObject:@(self.personModel.erbanNo).stringValue]) { UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = self.personModel.user_number; + pasteboard.string = @(self.personModel.erbanNo).stringValue; [self.view jk_makeToast:@"已复制ID到剪切板!"]; } } -- (void)setPersonModel:(AppUserModel *)personModel{ +- (void)setPersonModel:(UserInfoModel *)personModel{ _personModel = personModel; - [self.myIDBtn setTitle:[NSString stringWithFormat:@"ID:%@",personModel.user_number] forState:UIControlStateNormal]; + [self.myIDBtn setTitle:[NSString stringWithFormat:@"ID:%@",@(personModel.erbanNo)] forState:UIControlStateNormal]; [self.myIDBtn setImage:[UIImage imageNamed:@"myinfo_21"] forState:UIControlStateNormal]; [self.myIDBtn jk_setImagePosition:LXMImagePositionRight spacing:4]; - [self.myAgeBtn setTitle:[NSString stringWithFormat:@"%ld岁",personModel.age] forState:UIControlStateNormal]; - [self.myConsBtn setTitle:personModel.constellation forState:UIControlStateNormal]; - self.myContentLabel.text = personModel.signature; + [self.myAgeBtn setTitle:[NSString stringWithFormat:@"%@岁",[self dd_getUserAge:_personModel.birth]] forState:UIControlStateNormal]; + [self.myConsBtn setTitle:[self dd_getConstellationWithMonth:_personModel.birth] forState:UIControlStateNormal]; + self.myContentLabel.text = personModel.userDesc ?:@"这个人很懒,没什么签名~"; } +-(NSInteger) dd_getMonth:(long )time +{ + NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000]; + NSCalendar* calendar = [NSCalendar currentCalendar]; + NSDateComponents* components = [calendar components:NSCalendarUnitMonth fromDate:date]; + NSInteger month = components.month; + return month; +} + +- (NSInteger) dd_getDay:(long) time +{ + NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000]; + NSCalendar* calendar = [NSCalendar currentCalendar]; + NSDateComponents* components = [calendar components:NSCalendarUnitDay fromDate:date]; + NSInteger day = components.day; + return day; +} + +- (NSString *)dd_getConstellationWithMonth:(long)time +{ + NSString *astroString = @"魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯"; + NSString *astroFormat = @"102123444543"; + NSString *result; + + NSInteger month = [self dd_getMonth:time]; + NSInteger day = [self dd_getDay:time]; + + if (month<1 || month>12 || day<1 || day>31){ + return @"错误日期格式!"; + } + + if(month==2 && day>29) + { + return @"错误日期格式!!"; + }else if(month==4 || month==6 || month==9 || month==11) { + if (day>30) { + return @"错误日期格式!!!"; + } + } + + result=[NSString stringWithFormat:@"%@",[astroString substringWithRange:NSMakeRange(month*2-(day < [[astroFormat substringWithRange:NSMakeRange((month-1), 1)] intValue] - (-19))*2,2)]]; + + return [NSString stringWithFormat:@"%@座",result]; +} +- (NSString *)dd_getUserAge:(long)time { + NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000]; + NSCalendar *birthCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierISO8601]; + NSDateComponents *birthCompomemts = [birthCalendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitWeekday | NSCalendarUnitDay fromDate:date]; + NSInteger year = birthCompomemts.year; + NSInteger month = birthCompomemts.month; + NSInteger day = birthCompomemts.day; + NSLog(@"出生于%ld年%ld月%ld日", year, month, day); + + NSDate *nowDate = [NSDate date]; + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierISO8601]; + NSDateComponents *compomemts = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitWeekday | NSCalendarUnitDay fromDate:nowDate]; + NSInteger nowYear = compomemts.year; + NSInteger nowMonth = compomemts.month; + NSInteger nowDay = compomemts.day; + NSLog(@"今天是%ld年%ld月%ld日", nowYear, nowMonth, nowDay); + + // 计算年龄 + NSInteger userAge = nowYear - year - 1; + if ((nowMonth > month) || (nowMonth == month && nowDay >= day)) { + userAge++; + } + NSLog(@"用户年龄是%ld",userAge); + return [NSString stringWithFormat:@"%ld", userAge]; +} /* #pragma mark - Navigation diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationViewController.m index c60de7b..03953d9 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInformationViewController.m @@ -16,6 +16,8 @@ #import "DDMyInfoReportViewController.h" #import "DDMyInformationProfileViewController.h" #import "DDDynamicSendViewController.h" +#import "Api.h" +#import "UserInfoModel.h" @interface DDMyInformationViewController () @property (nonatomic, strong) UIImageView * topBgImageView; @property (nonatomic, strong) UIView * topNavView; @@ -30,6 +32,7 @@ @property (nonatomic, strong) UIButton * editBtn; @property (nonatomic, strong) AppUserModel * personModel; @property (nonatomic, strong) DDMyInformationProfileViewController * profileVC; +@property(nonatomic,strong) UserInfoModel *userModel; @end @implementation DDMyInformationViewController @@ -69,7 +72,6 @@ self.categoryView.titleFont = [UIFont systemFontOfSize:14]; self.categoryView.titleColorGradientEnabled = YES; [self.titlesArray addObject:@"资料"]; - [self.titlesArray addObject:@"动态"]; [self.titlesArray addObject:@"礼物墙"]; self.categoryView.titles = self.titlesArray; [self.view addSubview:self.topBgImageView]; @@ -123,6 +125,19 @@ -(void)getUserInfo { WeakSelf(weakSelf) + + [Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + + if(code == 200){ + UserInfoModel *userModel = [UserInfoModel DD_ModelWithDict:data.data]; + self.userModel = userModel; + weakSelf.profileVC.personModel = userModel; + weakSelf.titLabel.text = userModel.nick; + [weakSelf.headerView updataPersonInfoWithModel:userModel]; + } + } uid:self.user_id]; + return; + NSMutableDictionary *requestDict = [NSMutableDictionary dictionary]; if (![ToolsObject IsNullWithObject:self.user_id]) { [requestDict setObject:self.user_id forKey:@"user_id"]; @@ -134,11 +149,11 @@ } AppUserModel * myModel = [ToolsObject getUserModel]; weakSelf.personModel = [AppUserModel yy_modelWithJSON:response.data]; - if (weakSelf.profileVC) { + if (weakSelf.profileVC) { weakSelf.profileVC.user_id = self.user_id; weakSelf.profileVC.personModel = self.personModel; } - dispatch_async(dispatch_get_main_queue(), ^{ + dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.headerView updataPersonInfoWithModel:weakSelf.personModel]; weakSelf.titLabel.text = weakSelf.personModel.nickname; @@ -242,11 +257,6 @@ - (id)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index { if (index ==0){ return self.profileVC; - }else if (index ==1){ - DDMyInformationDynamicViewController *listVC = [[DDMyInformationDynamicViewController alloc] init]; - listVC.user_id = self.user_id; - listVC.model = self.personModel; - return listVC; }else{ DDMyInformationGiftWallViewController *list = [[DDMyInformationGiftWallViewController alloc] init]; list.user_id = self.user_id; diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/MM/DDGiftWallModel.h b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/MM/DDGiftWallModel.h index a011c48..3f8133c 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/MM/DDGiftWallModel.h +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/MM/DDGiftWallModel.h @@ -25,6 +25,18 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) NSString * charm; @property (nonatomic, copy) NSString * gift_name; @property (nonatomic, copy) NSString *random_gift_name; +///目标用户的uid +@property (nonatomic,copy) NSString *uid; +///价格 +@property (nonatomic,assign) NSInteger giftPrice; +///id +@property (nonatomic,assign) NSInteger giftId; +///名称 +@property (nonatomic,copy) NSString *giftName; +///礼物 +@property (nonatomic,copy) NSString *picUrl; +///个数 +@property (nonatomic,assign) NSInteger reciveCount; @end diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInfoGiftWallCollectionViewCell.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInfoGiftWallCollectionViewCell.m index 74ed914..c2c05d1 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInfoGiftWallCollectionViewCell.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInfoGiftWallCollectionViewCell.m @@ -74,8 +74,8 @@ } - (void)setModel:(DDGiftWallModel *)model{ _model = model; - [self.contentImg ddSetAnimatedImageView:[NSURL URLWithString:model.big_img] placeholderImage:DDPlaceholderGiftImage()]; - self.titLabel.text = model.title; - self.numLabel.text = [NSString stringWithFormat:@"x%@",model.gift_num]; + [self.contentImg ddSetAnimatedImageView:[NSURL URLWithString:model.picUrl] placeholderImage:DDPlaceholderGiftImage()]; + self.titLabel.text = model.giftName; + self.numLabel.text = [NSString stringWithFormat:@"x%ld",model.reciveCount]; } @end diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.h b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.h index 4d5ff9c..f6251a1 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.h +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.h @@ -9,11 +9,12 @@ #import "DDMyInfoGotoRoomView.h" #import "DDMyInfoInsertDynamicView.h" #import "DDMyAgeView.h" +#import "UserInfoModel.h" NS_ASSUME_NONNULL_BEGIN @interface DDMyInformationHeaderView : UIView @property (nonatomic,strong) UIView *shadowView; -@property (nonatomic,strong) AppUserModel *model; +@property (nonatomic,strong) UserInfoModel *model; @property (nonatomic,assign) float bgImageheight; @property (nonatomic,strong) UIImageView *bgImageView; @property (nonatomic,strong) UILabel *nameLabel; @@ -30,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) DDMyInfoInsertDynamicView *addDynamicView; - (instancetype)initWithFrame:(CGRect)frame ; @property (nonatomic,copy) void (^didReleaseDynamic)(void); --(void)updataPersonInfoWithModel:(AppUserModel *)model; +-(void)updataPersonInfoWithModel:(UserInfoModel *)model; @end NS_ASSUME_NONNULL_END diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.m index 84a822a..32f689f 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/VV/DDMyInformationHeaderView.m @@ -19,25 +19,25 @@ } return self; } --(void)updataPersonInfoWithModel:(AppUserModel *)model{ +-(void)updataPersonInfoWithModel:(UserInfoModel *)model{ self.model = model; [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:DDPlaceholderHeadImage()]; - self.nameLabel.text = model.nickname; - NSString *fansText = [NSString stringWithFormat:@"%ld 粉丝",model.fans_num]; + self.nameLabel.text = model.nick; + NSString *fansText = [NSString stringWithFormat:@"%ld 粉丝",model.fansNum]; self.fansLabel.text = fansText; - [self fuwenLabel:self.fansLabel changeString:[NSString stringWithFormat:@"%ld ",model.fans_num] andAllColor:[UIColor whiteColor] andMarkColor:[UIColor whiteColor] andMarkFondSize:16]; - NSString *followText = [NSString stringWithFormat:@"%ld 关注",model.attention_num]; + [self fuwenLabel:self.fansLabel changeString:[NSString stringWithFormat:@"%ld ",model.fansNum] andAllColor:[UIColor whiteColor] andMarkColor:[UIColor whiteColor] andMarkFondSize:16]; + NSString *followText = [NSString stringWithFormat:@"%ld 关注",model.followNum]; self.followLabel.text = followText; - [self fuwenLabel:self.followLabel changeString:[NSString stringWithFormat:@"%ld ",model.attention_num] andAllColor:[UIColor whiteColor] andMarkColor:[UIColor whiteColor] andMarkFondSize:16]; + [self fuwenLabel:self.followLabel changeString:[NSString stringWithFormat:@"%ld ",model.followNum] andAllColor:[UIColor whiteColor] andMarkColor:[UIColor whiteColor] andMarkFondSize:16]; // [self.idBtn setTitle:[NSString stringWithFormat:@"ID:%@",model.user_number] forState:UIControlStateNormal]; // [self.idBtn setImage:[UIImage imageNamed:@"myinfo_21"] forState:UIControlStateNormal]; // [self.idBtn setImagePositionWithType:SSImagePositionTypeRight spacing:5]; - [self.vipImage sd_setImageWithURL:[NSURL URLWithString:model.level_icon]]; - [self.ageView changeAge:[NSString stringWithFormat:@"%ld",model.age] andSex:model.sex andRadius:8]; +// [self.vipImage sd_setImageWithURL:[NSURL URLWithString:model.level_icon]]; + [self.ageView changeAge:[NSString stringWithFormat:@"%d",model.gender] andSex:model.gender andRadius:8]; // self.contentLabel.text = model.signature; AppUserModel * myModel = [ToolsObject getUserModel]; - if ([model.user_id isEqualToString:myModel.user_id]) { + if ([@(model.uid).stringValue isEqualToString:myModel.user_id]) { [self addSubview:self.addDynamicView]; [self.addDynamicView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.bottomView.mas_top).mas_offset(20); @@ -45,7 +45,7 @@ make.height.mas_equalTo(40); }]; }else{ - if (model.in_live) { + if (model.roomUid > 0) { [self addSubview:self.goLiveView]; [self.goLiveView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.bottomView.mas_top).mas_offset(20); @@ -136,9 +136,9 @@ } - (void)idBtnClick{ - if (![ToolsObject IsNullWithObject:self.model.user_number]) { + if (![ToolsObject IsNullWithObject:@(self.model.erbanNo).stringValue]) { UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = self.model.user_number; + pasteboard.string = @(self.model.erbanNo).stringValue; [ToolsObject addPopVieToText:@"已复制ID到剪切板"]; } } @@ -209,7 +209,7 @@ _goLiveView.backgroundColor = [UIColor whiteColor]; WeakSelf(weakSelf) _goLiveView.goLive = ^{ - [[ToolsObject shareTools] jumpToRoomVC:weakSelf.model.in_live_room_id followUser:[RoomUserInfoModel new]]; + [[ToolsObject shareTools] jumpToRoomVC:weakSelf.model.roomUid followUser:[RoomUserInfoModel new]]; }; } return _goLiveView; diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.m index d003006..19e8d03 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.m @@ -9,7 +9,7 @@ #import "DDExchangeVC.h" #import "DDMyRechargeVC.h" #import "DDMyExchangeVC.h" - +#import "Api.h" @interface DDMyWalletVC () @property (weak, nonatomic) IBOutlet UIView *topView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topView_Y; @@ -28,7 +28,7 @@ //获取砖石数量 [self getDiamond]; //获取个人收益 - [self getIncome]; +// [self getIncome]; } - (void)viewDidLoad { @@ -39,6 +39,20 @@ } - (void)getDiamond { + @weakify(self); + NSString *uid = [[AccountInfoStorage instance]getUid]; + NSString * ticket = [AccountInfoStorage instance].getTicket; + [Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + @strongify(self) + if(code == 200){ + AppUserModel * myModel = [AppUserModel DD_ModelWithDict:data.data]; + [ToolsObject saveUserModel:myModel]; + self.diamondLabel.text = [NSString stringWithFormat:@"%@",myModel.diamonds]; + } + + } uid:uid ticket:ticket]; + + return; [NetworkRequest requestPOST:@"/finance/diamond" parameters:@{} block:^(BaseResponse * _Nonnull response) { if (response.isSuccess) { diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.xib b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.xib index 5408f59..5e4e066 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.xib +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/我的钱包/DDMyWalletVC.xib @@ -1,9 +1,9 @@ - + - + @@ -145,7 +145,7 @@ -