-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
334 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// PCComicSimilarRequest.h | ||
// Pica | ||
// | ||
// Created by Fancy on 2022/3/1. | ||
// Copyright © 2022 fancy. All rights reserved. | ||
// | ||
|
||
#import "PCRequest.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface PCComicSimilarRequest : PCRequest | ||
|
||
@property (nonatomic, copy) NSString *comicId; | ||
- (instancetype)initWithComicId:(NSString *)comicId; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// PCComicSimilarRequest.m | ||
// Pica | ||
// | ||
// Created by Fancy on 2022/3/1. | ||
// Copyright © 2022 fancy. All rights reserved. | ||
// | ||
|
||
#import "PCComicSimilarRequest.h" | ||
#import <YYModel/YYModel.h> | ||
#import "PCComic.h" | ||
|
||
@implementation PCComicSimilarRequest | ||
|
||
- (instancetype)initWithComicId:(NSString *)comicId { | ||
if (self = [super init]) { | ||
_comicId = [comicId copy]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)sendRequest:(void (^)(id response))success | ||
failure:(void (^)(NSError *error))failure { | ||
[super sendRequest:success failure:failure]; | ||
|
||
[self startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) { | ||
NSArray *comics = [NSArray yy_modelArrayWithClass:PCComic.class json:request.responseJSONObject[@"data"][@"comics"]]; | ||
!success ? : success(comics); | ||
} failure:^(__kindof YTKBaseRequest * _Nonnull request) { | ||
!failure ? : failure(request.error); | ||
}]; | ||
} | ||
|
||
- (NSString *)requestUrl { | ||
return [NSString stringWithFormat:PC_API_COMICS_RECOMMENDATION, self.comicId]; | ||
} | ||
|
||
- (NSDictionary<NSString *,NSString *> *)requestHeaderFieldValueDictionary { | ||
return [PCRequest headerWithUrl:[self requestUrl] method:@"GET" time:[NSDate date]]; | ||
} | ||
|
||
- (YTKRequestMethod)requestMethod { | ||
return YTKRequestMethodGET; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// PCComicRecommendView.h | ||
// Pica | ||
// | ||
// Created by Fancy on 2022/3/2. | ||
// Copyright © 2022 fancy. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
@class PCComic; | ||
@interface PCComicRecommendView : UIView | ||
|
||
@property (nonatomic, copy) NSArray <PCComic *>*comicArray; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.