Files
yinmeng-ios/xplan-ios/Main/Message/Presenter/MessagePresenter.m
2023-08-31 17:50:20 +08:00

68 lines
2.4 KiB
Objective-C

//
// MessagePresenter.m
// xplan-ios
//
// Created by zu on 2021/12/8.
//
#import "MessagePresenter.h"
#import "Api+Message.h"
#import "ChatLimitModel.h"
#import "MessageProtocol.h"
#import "Api+Mine.h"
#import "UserInfoModel.h"
#import "AccountInfoStorage.h"
#import "UserGameInfoVo.h"
@implementation MessagePresenter
- (void)getChatLimitReceiverUid:(NSString *)receiverUid {
[Api getChatLimit:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
ChatLimitModel *chatLimit = [ChatLimitModel modelWithJSON:data.data];
[[self getView] onGetLimitChat:chatLimit];
} showLoading:NO errorToast:NO] receiverUid:receiverUid];
}
/// 获取用户信息
/// @param uid 用户uid
- (void)getUserInfo:(NSString *)uid {
[Api userDetailInfoCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetSessionUserInfoSuccess:infoModel];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]onGetSessionUserInfoFail];
}] uid:uid page:@"1" pageSize:@"20"];
}
///是否关注当前用户
- (void)getFansLike:(NSString *)likeUid {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api attentionStatusCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
BOOL isLike = [data.data boolValue];
[[self getView] getFansLikeSuccess:isLike];
}] uid:uid isLikeUid:likeUid];
}
/// 关注用户
/// @param targetUid 目标用户的uid
- (void)attentionUser:(NSString *)targetUid {
NSString * uid = [[AccountInfoStorage instance] getUid];
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSString * type = @"1";
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] attentionUserSuccess:targetUid];
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAttentionUserNotification" object:nil];
} showLoading:YES] uid:uid likedUid:targetUid ticket:ticket type:type];
}
///用户的游戏配置信息
-(void)getGamePartnerInfoListWithUid:(NSString *)uid{
if(uid.length == 0)return;
[Api requestGamePartnerInfoList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *list = [UserGameInfoVo modelsWithArray:data.data];
[[self getView]getGamePartnerInfoList:list];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] uid:uid];
}
@end