修改邀请
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#import "KBCharacter.h"
|
||||
#import "KBMyTheme.h"
|
||||
#import "KBConsumptionRecord.h"
|
||||
#import "KBInviteCodeModel.h"
|
||||
@class KBUser;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@@ -28,11 +29,14 @@ typedef void(^KBMyPurchasedThemesCompletion)(NSArray<KBMyTheme *> *_Nullable the
|
||||
typedef void(^KBDeleteThemesCompletion)(BOOL success, NSError *_Nullable error);
|
||||
typedef void(^KBSubmitFeedbackCompletion)(BOOL success, NSError *_Nullable error);
|
||||
typedef void(^KBMyPurchaseRecordCompletion)(NSArray<KBConsumptionRecord *> *_Nullable records, NSError *_Nullable error);
|
||||
typedef void(^KBMyInviteCodeCompletion)(KBInviteCodeModel *_Nullable inviteCode, NSError *_Nullable error);
|
||||
|
||||
@interface KBMyVM : NSObject
|
||||
|
||||
/// 获取当前用户详情(/user/detail)
|
||||
- (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion;
|
||||
/// 查询邀请码(/user/inviteCode)
|
||||
- (void)fetchInviteCodeWithCompletion:(KBMyInviteCodeCompletion)completion;
|
||||
|
||||
/// 用户人设列表(/character/listByUser)
|
||||
- (void)fetchCharacterListByUserWithCompletion:(KBCharacterListCompletion)completion;
|
||||
|
||||
@@ -51,6 +51,31 @@ NSString * const KBUserCharacterDeletedNotification = @"KBUserCharacterDeletedNo
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fetchInviteCodeWithCompletion:(KBMyInviteCodeCompletion)completion {
|
||||
[[KBNetworkManager shared] GET:API_USER_INVITE_CODE
|
||||
parameters:nil
|
||||
headers:nil
|
||||
autoShowBusinessError:NO
|
||||
completion:^(NSDictionary *jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error) {
|
||||
if (completion) completion(nil, error);
|
||||
return;
|
||||
}
|
||||
|
||||
id dataObj = jsonOrData[KBData] ?: jsonOrData[@"data"];
|
||||
if (![dataObj isKindOfClass:[NSDictionary class]]) {
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||
code:KBNetworkErrorInvalidResponse
|
||||
userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Invalid response")}];
|
||||
if (completion) completion(nil, e);
|
||||
return;
|
||||
}
|
||||
|
||||
KBInviteCodeModel *model = [KBInviteCodeModel mj_objectWithKeyValues:(NSDictionary *)dataObj];
|
||||
if (completion) completion(model, nil);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fetchCharacterListByUserWithCompletion:(KBCharacterListCompletion)completion{
|
||||
[[KBNetworkManager shared] GET:KB_API_CHARACTER_LISTBYUSER
|
||||
parameters:nil
|
||||
|
||||
Reference in New Issue
Block a user