// // YMMonentsTopicLatestPresenter.m // YUMI // // Created by YUMI on 2022/8/18. // #import "XPMonentsTopicLatestPresenter.h" #import "Api+Moments.h" #import "AccountInfoStorage.h" #import "MomentsListInfoModel.h" #import "XPMonentsTopicLatestProtocol.h" @implementation XPMonentsTopicLatestPresenter - (void)getMonentsTopicLatestList:(NSString *)dynamicId worldId:(NSString *)worldId state:(int)state { NSString * uid = [AccountInfoStorage instance].getUid; [Api momentsTopicLatestList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { MomentsListInfoModel * model = [MomentsListInfoModel modelWithDictionary:data.data]; [[self getView] getMonentsTopicLatestListSuccess:model state:state]; }fail:^(NSInteger code, NSString * _Nullable msg) { [[self getView] getMonentsTopicLatestListFail:msg state:state]; } showLoading:YES] uid:uid dynamicId:dynamicId types:@"0,2" worldId:worldId pageSize:@"20"]; } /// 动态点赞 /// @param dynamicId 动态id /// @param status yes 点赞 NO 取消 /// @param likedUid 点赞人的uid /// @param worldId 话题的id - (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId { NSString * uid = [AccountInfoStorage instance].getUid; NSString * statusStr = status ? @"1" : @"0"; [Api momentsLike:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] likeMonentsSuccess:dynamicId status:status]; } showLoading:YES] dynamicId:dynamicId uid:uid status:statusStr likedUid:likedUid worldId:worldId]; } /// 删除动态 /// @param dynamicId 动态id /// @param worldId 话题id - (void)deleteMonents:(NSString *)dynamicId worldId:(NSString *)worldId { NSString * uid = [AccountInfoStorage instance].getUid; [Api momentsDelete:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { [[self getView] deleteMonentsSuccess:dynamicId]; } uid:uid dynamicId:dynamicId worldId:worldId]; } - (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{ [Api requestShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] requesstShieldingSuccess:objId]; }] type:type objId:objId]; } @end