68 lines
2.1 KiB
Mathematica
68 lines
2.1 KiB
Mathematica
![]() |
//
|
||
|
// YMMineUserInfoPresenter.m
|
||
|
// YUMI
|
||
|
//
|
||
|
// Created by YUMI on 2021/9/23.
|
||
|
//
|
||
|
|
||
|
#import "XPMineUserInfoPresenter.h"
|
||
|
///Tool
|
||
|
#import "Api+Mine.h"
|
||
|
#import "AccountInfoStorage.h"
|
||
|
///Model
|
||
|
#import "UserInfoModel.h"
|
||
|
///P
|
||
|
#import "XPMineUserInfoProtocol.h"
|
||
|
|
||
|
@implementation XPMineUserInfoPresenter
|
||
|
|
||
|
// 获取用户信息
|
||
|
- (void)getUserInfoWithUid:(NSString *)uid {
|
||
|
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||
|
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
||
|
[[self getView] onGetUserInfoSuccess:infoModel];
|
||
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||
|
|
||
|
}] uid:uid];
|
||
|
}
|
||
|
|
||
|
// 获取用户详细信息
|
||
|
- (void)getUserDetailInfoWithUid:(NSString *)uid {
|
||
|
[Api userDetailInfoCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||
|
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
||
|
[[self getView] ongetDetailInfoSuccess:infoModel];
|
||
|
}] uid:uid page:@"1" pageSize:@"20"];
|
||
|
}
|
||
|
|
||
|
/// 两个人的关注状态
|
||
|
/// @param targetUid 对方的uid
|
||
|
- (void)getUserAttentionState:(NSString *)targetUid; {
|
||
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||
|
[Api attentionStatusCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||
|
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||
|
[[self getView] getAttentionStateSuccess:isLike];
|
||
|
}] uid:uid isLikeUid:targetUid];
|
||
|
}
|
||
|
|
||
|
|
||
|
/// 关注用户 /取消该关注
|
||
|
/// @param targetUid 目标用户的uid
|
||
|
/// @param state 是否关注 yes 关注 NO 取消关注
|
||
|
- (void)attentionUser:(NSString *)targetUid state:(BOOL)state {
|
||
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||
|
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||
|
NSString * type = state ? @"1" : @"2";
|
||
|
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||
|
[[self getView] attentionUserSuccess:state];
|
||
|
}] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||
|
}
|
||
|
|
||
|
///上传访问用户主页记录
|
||
|
///@param targetUid 被访问用户的uid
|
||
|
- (void)visitUser:(NSString *)targetUid {
|
||
|
[Api uploadVisitUserCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||
|
}] uid:targetUid];
|
||
|
}
|
||
|
|
||
|
@end
|