动态接口对接

This commit is contained in:
liyuhua
2023-12-13 19:36:00 +08:00
parent 1a90a9d9c4
commit 60a5983a98
12 changed files with 133 additions and 30 deletions

View File

@@ -6,7 +6,7 @@
//
#import "WLBaseViewController.h"
#import "UserInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDEditMyInfoViewController : WLBaseViewController<UITextFieldDelegate>
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString * avator;//头像
@property (nonatomic, copy) NSString * nickName;//昵称
@property (nonatomic, copy) NSString * singer;//签名
@property (nonatomic, strong) AppUserModel * personModel;
@property (nonatomic, strong) UserInfoModel * personModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -13,6 +13,7 @@
#import "FileToolsObject.h"
#import <LSTPopView.h>
#import "RoomUserManagementView.h"
#import "Api.h"
@interface DDEditMyInfoViewController ()
/****/
@@ -27,14 +28,14 @@
// Do any additional setup after loading the view.
[self defaultNavTitle:@"编辑资料" hideLine:YES];
self.view.backgroundColor = UIColor.whiteColor;
self.birthdayContent = self.personModel.birthday;
self.birthdayContent = @(self.personModel.birth).stringValue;
self.avator = self.personModel.avatar;
self.sexStr = self.personModel.sex == 1 ? @"男":@"女";
self.nickName = self.personModel.nickname;
if ([ToolsObject IsNullWithObject:self.personModel.signature]) {
self.personModel.signature = @"高冷的TA不喜欢留签名";
self.sexStr = self.personModel.gender == 1 ? @"男":@"女";
self.nickName = self.personModel.nick;
if ([ToolsObject IsNullWithObject:self.personModel.userDesc]) {
self.personModel.userDesc = @"高冷的TA不喜欢留签名";
}
self.singer = self.personModel.signature;
self.singer = self.personModel.userDesc;
[self.customNavBar addSubview:self.rightBtn];
[self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
@@ -107,13 +108,46 @@
//
- (void)rightBtnClick {
WeakSelf(weakSelf);
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
if (self.avator.length > 0) {
[dic setObject:self.avator forKey:@"avatar"];
}
if (self.nickName.length > 0) {
[dic setObject:self.nickName forKey:@"nick"];
}
// if (self.birthdayContent.length > 0) {
// [dic setObject:self.birthdayContent forKey:@"birth"];
// }
if (self.singer.length > 0) {
[dic setObject:self.singer forKey:@"userDesc"];
}
[dic setObject:uid forKey:@"uid"];
[dic setObject:ticket forKey:@"ticket"];
[Api completeUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
[ToolsObject addPopVieToText:@"修改完成"];
[weakSelf.navigationController popViewControllerAnimated:YES];
}
} userInfo:dic];
return;
NSMutableDictionary *requestDict = [NSMutableDictionary dictionary];
[requestDict setObject:self.birthdayContent forKey:@"birthday"];
[requestDict setObject:self.avator forKey:@"avatar"];
[requestDict setObject:[self.sexStr isEqualToString:@"男"]?@"1":@"2" forKey:@"sex"];
[requestDict setObject:self.nickName forKey:@"nickname"];
[requestDict setObject:self.singer forKey:@"signature"];
WeakSelf(weakSelf);
[NetworkRequest requestPOST:@"/my/edit/user" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
if (response.code == 200) {
[ToolsObject addPopVieToText:@"修改完成"];
@@ -223,7 +257,7 @@
}
-(void)uploadAvatarRequest{
WeakSelf(weakSelf)
[[ResourcePickerToolsObject shareIntance] getImageVideoWithIsVideo:NO WithIsImage:YES maxImagesCount:1 columnNumber:3 pushPhotoPickerVc:YES allowTakePicture:YES allowTakeVideo:NO allowPickingGif:YES imagePickerBlock:^(TZImagePickerController * _Nonnull picker, NSArray<UIImage *> * _Nonnull photos, NSArray * _Nonnull assets, BOOL isSelectOriginalPhoto, BOOL isSelectGifPhoto) {
[[ResourcePickerToolsObject shareIntance] getImageVideoWithIsVideo:NO WithIsImage:YES maxImagesCount:1 columnNumber:3 pushPhotoPickerVc:YES allowTakePicture:YES allowTakeVideo:NO allowPickingGif:NO imagePickerBlock:^(TZImagePickerController * _Nonnull picker, NSArray<UIImage *> * _Nonnull photos, NSArray * _Nonnull assets, BOOL isSelectOriginalPhoto, BOOL isSelectGifPhoto) {
PHImageRequestOptions * options = [[PHImageRequestOptions alloc] init];
options.resizeMode = PHImageRequestOptionsResizeModeFast;
options.synchronous = YES;
@@ -244,16 +278,20 @@
[imageArr addObject:imageData];
[weakSelf uploadGIFImage:imageArr];
}else{
NSString *path = [FileToolsObject libraryDir];
NSMutableArray *imageArr = @[].mutableCopy;
for (UIImage * image in photos) {
NSString * imgUrl = [NSString stringWithFormat:@"source/personInfo/image/%@.jpg",[ToolsObject dateChangeRealtimestamp]];
[FileToolsObject createFileAtPath:[path stringByAppendingPathComponent:imgUrl] overwrite:YES];
NSData *thumbImageData = [ToolsObject compressWithMaxLength:1024 WithImage:image];
[imageArr addObject:[path stringByAppendingPathComponent:imgUrl]];
[FileToolsObject writeFileAtPath:[path stringByAppendingPathComponent:imgUrl] content:thumbImageData];
}
[weakSelf uploadImage:imageArr];
if(photos.count > 0){
self.headerImgV.image = photos.firstObject;
}
// NSString *path = [FileToolsObject libraryDir];
// NSMutableArray *imageArr = @[].mutableCopy;
// for (UIImage * image in photos) {
// NSString * imgUrl = [NSString stringWithFormat:@"source/personInfo/image/%@.jpg",[ToolsObject dateChangeRealtimestamp]];
// [FileToolsObject createFileAtPath:[path stringByAppendingPathComponent:imgUrl] overwrite:YES];
// NSData *thumbImageData = [ToolsObject compressWithMaxLength:1024 WithImage:image];
// [imageArr addObject:[path stringByAppendingPathComponent:imgUrl]];
// [FileToolsObject writeFileAtPath:[path stringByAppendingPathComponent:imgUrl] content:thumbImageData];
// }
// [weakSelf uploadImage:imageArr];
}
}];
} videoPickerControllerBlock:^(TZImagePickerController * _Nonnull picker, UIImage * _Nonnull coverImage, PHAsset * _Nonnull asset) {}];

View File

@@ -72,7 +72,7 @@
[DDCellModel addDataWithName:@"清除缓存" icon:@"" cellType:DDCellModelType_Normal setType:(DDMyInfoModelType_ClearCache) content:[NSString stringWithFormat:@"%.2fM",[self getAppCacheSize]]],
[DDCellModel addDataWithName:@"位置显示" icon:@"" cellType:DDCellModelType_Switch setType:(DDMyInfoModelType_Location) content:[NSString stringWithFormat:@"%d",[AppDelegate getAppdelegate].isLocation]],
[DDCellModel addDataWithName:@"应用内通知" icon:@"" cellType:DDCellModelType_Switch setType:(DDMyInfoModelType_Notification) content:[NSString stringWithFormat:@"%d",[ToolsObject getUserModel].is_notification]],
[DDCellModel addDataWithName:@"" icon:@"" cellType:DDCellModelType_Copyright setType:(DDMyInfoModelType_Copyright) content:@"Copyright © 2022 - 2080\n奔梦科技 版权所有"],
// [DDCellModel addDat/*aWithName:@"" icon:@"" cellType:DDCellModelType_Copyright setType:(DDMyInfoModelType_Copyright) content:@"Copyright © 2022 - 2080\n奔梦科技 版权所有"],*/
].mutableCopy;
}
return _listArr;

View File

@@ -125,11 +125,15 @@
-(void)getUserInfo
{
WeakSelf(weakSelf)
NSString *uid = [[AccountInfoStorage instance]getUid];
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
UserInfoModel *userModel = [UserInfoModel DD_ModelWithDict:data.data];
if ([self.user_id isEqualToString:uid]) {
self.moreButton.hidden = YES;
[weakSelf.view addSubview:weakSelf.editBtn];
}
self.userModel = userModel;
weakSelf.profileVC.personModel = userModel;
weakSelf.titLabel.text = userModel.nick;

View File

@@ -52,6 +52,20 @@ NS_ASSUME_NONNULL_BEGIN
//@property (nonatomic, strong) UserVipInfoVo *userVipInfoVO;
/////是否在房间中 本地字段
//@property (nonatomic,assign) ContactUseingType useingType;
///在线人数
@property (nonatomic,assign) NSInteger onlineNum;
///标题
@property (nonatomic,copy) NSString *title;
///搜索用户的时候 如果用户在房间中的话 就有roomUid
@property (nonatomic,copy) NSString *roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -11,7 +11,7 @@
#import "DDSearchRoomCell.h"
#import "DDRoomPartyModel.h"
#import "DDFansFollowVisitModel.h"
#import "Api+DDHomeApi.h"
@interface DDSearchListVC () <UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, assign) NSInteger pageNum;
@@ -50,6 +50,20 @@
}
-(void)initRequest
{
WeakSelf(weakSelf)
[Api searchComplection:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[weakSelf endrefresh];
if(code == 200){
if (weakSelf.pageNum == 1) {
[weakSelf.userListArr removeAllObjects];
}
NSArray *list = [DDFansFollowVisitModel DD_ModelsWithArray:data.data];
[weakSelf.userListArr addObjectsFromArray:list];
[self.searchTable reloadData];
}
} key:self.searchStr type:@"2" page:@(self.pageNum).stringValue pageSize:@"20"];
return;
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
//
if ([self.typeStr isEqualToString:@"综合"]) {
@@ -62,10 +76,10 @@
[dic setObject:self.searchStr ?: @"" forKey:@"keywords"];
[dic setObject:@(20) forKey:@"current_page"];
[dic setObject:@(self.pageNum) forKey:@"page_number"];
@weakify(self)
[NetworkRequest requestPOST:@"/home/search" parameters:dic block:^(BaseResponse * _Nonnull response) {
@strongify(self);
if (response.isSuccess) {
if ([ToolsObject IsNullWithObject:response.data]) {
return;
@@ -102,11 +116,11 @@
}
}
dispatch_async(dispatch_get_main_queue(), ^{
@strongify(self);
[self.searchTable reloadData];
});
} else {
@strongify(self)
[self endrefresh];
}
}];
@@ -358,7 +372,7 @@
}
self.isClick = YES;
DDFansFollowVisitModel *model = self.userListArr[indexPath.row];
[ToolsObject pushMyInformationViewController:model.id];
[ToolsObject pushMyInformationViewController:model.uid];
@weakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
@strongify(self);

View File

@@ -14,6 +14,7 @@
#import "DDRoomPartyModel.h"
#import "DDFansFollowVisitModel.h"
#import "DDSearchListVC.h"
#import "Api+DDHomeApi.h"
@interface DDSearchPageViewController ()
/** */
@property(nonatomic,strong) DDSearchBarView * searchBarView;
@@ -160,12 +161,37 @@
}
}
- (void)requestUserHomeSearch{
WeakSelf(weakSelf)
[Api searchComplection:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
[weakSelf.userListArr removeAllObjects];
NSArray *list = [DDFansFollowVisitModel DD_ModelsWithArray:data.data];
[weakSelf.userListArr addObjectsFromArray:list];
if (weakSelf.userListArr.count == 0 && weakSelf.roomListArr.count == 0) {
//
[weakSelf.titlesArray removeAllObjects];
weakSelf.noDataView.hidden = NO;
}else{
//
weakSelf.noDataView.hidden = YES;
[weakSelf.titlesArray removeAllObjects];
if (weakSelf.userListArr.count>0) {
[weakSelf.titlesArray addObject:@"用户"];
}
}
weakSelf.categoryView.titles = self.titlesArray;
[weakSelf.pagerView reloadData];
[weakSelf.categoryView reloadData];
}
} key:self.contentStr type:@"2" page:@"1" pageSize:@"20"];
return;
NSMutableDictionary * requestDict = [NSMutableDictionary dictionary];
[requestDict setObject:[ToolsObject IsNullWithObject:self.contentStr]?@"":self.contentStr forKey:@"keywords"];
[requestDict setObject:@"all" forKey:@"type"];
[requestDict setObject:@(20) forKey:@"current_page"];
[requestDict setObject:@(1) forKey:@"page_number"];
WeakSelf(weakSelf)
[NetworkRequest requestPOST:@"/home/search" parameters:requestDict block:^(BaseResponse * _Nonnull response) {
if (response.code == 200){
[weakSelf.userListArr removeAllObjects];

View File

@@ -163,7 +163,7 @@
if ([type isEqualToString:@"主页"]) {
NSString *uid = [[AccountInfoStorage instance]getUid];
AppUserModel * myModel = [ToolsObject getUserModel];
[ToolsObject pushMyInformationViewController:uid];
} else if ([type isEqualToString:@"粉丝"]) {
DDFollowFansPVC * listVC = [[DDFollowFansPVC alloc] init];

View File

@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)homeTagComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid;
+ (void)homeRecommendRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
+ (void)getRecommendListComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid tabId:(NSString *)tabId pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize;
+ (void)searchComplection:(HttpRequestHelperCompletion)complection key:(NSString *)key type:(NSString *)type page:(NSString *)page pageSize:(NSString *)pageSize;
@end
NS_ASSUME_NONNULL_END

View File

@@ -29,4 +29,7 @@
+ (void)getRecommendListComplection:(HttpRequestHelperCompletion)complection uid:(NSString *)uid tabId:(NSString *)tabId pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize {
[self makeRequest:@"home/tab/mapV2" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, tabId, pageNum, pageSize, nil];
}
+ (void)searchComplection:(HttpRequestHelperCompletion)complection key:(NSString *)key type:(NSString *)type page:(NSString *)page pageSize:(NSString *)pageSize {
[self makeRequest:@"search/room" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, key, type, page, pageSize, nil];
}
@end

View File

@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)dd_RequestIAPRecharge:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId uid:(NSString *)uid ticket:(NSString *)ticket deviceInfo:(NSString *)deviceInfo clientIp:(NSString *)clientIp;
+ (void)requestDressUpShopList:(HttpRequestHelperCompletion)completion dressType:(NSString *)dressType;
+ (void)getUserGiftWall:(HttpRequestHelperCompletion)comletion uid:(NSString *)uid giftType:(NSString *)giftType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -41,4 +41,6 @@
+ (void)getUserGiftWall:(HttpRequestHelperCompletion)comletion uid:(NSString *)uid giftType:(NSString *)giftType {
[self makeRequest:@"giftwall/getByGiftType" method:HttpRequestHelperMethodGET completion:comletion, __FUNCTION__, uid, giftType, nil];
}
@end