chore: import upstream snapshot with attribution
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// TLExpressionGroupModel+SearchRequest.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/2.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLExpressionGroupModel.h"
|
||||
|
||||
@interface TLExpressionGroupModel (SearchRequest)
|
||||
|
||||
/**
|
||||
* 表情搜索
|
||||
*/
|
||||
+ (TLBaseRequest *)requestExpressionSearchByKeyword:(NSString *)keyword success:(TLRequestSuccessBlock)success failure:(TLRequestFailureBlock)failure;
|
||||
|
||||
@end
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// TLExpressionGroupModel+SearchRequest.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/1/2.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLExpressionGroupModel+SearchRequest.h"
|
||||
#import "TLNetworking.h"
|
||||
|
||||
#define IEXPRESSION_SEARCH_URL [IEXPRESSION_HOST_URL stringByAppendingString:@"expre/listBy.do?pageNumber=1&status=Y&eName=%@&seach=yes"]
|
||||
|
||||
@implementation TLExpressionGroupModel (SearchRequest)
|
||||
|
||||
+ (TLBaseRequest *)requestExpressionSearchByKeyword:(NSString *)keyword success:(TLRequestSuccessBlock)success failure:(TLRequestFailureBlock)failure
|
||||
{
|
||||
NSString *urlString = [NSString stringWithFormat:IEXPRESSION_SEARCH_URL, [[keyword urlEncode] urlEncode]];
|
||||
[TLNetworking postUrl:urlString parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
NSArray *respArray = [responseObject mj_JSONObject];
|
||||
NSString *status = respArray[0];
|
||||
if ([status isEqualToString:@"OK"]) {
|
||||
NSArray *infoArray = respArray[2];
|
||||
NSMutableArray *data = [TLExpressionGroupModel mj_objectArrayWithKeyValuesArray:infoArray];
|
||||
if (success) {
|
||||
success(data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (failure) {
|
||||
failure(status);
|
||||
}
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask *task, NSError *error) {
|
||||
if (failure) {
|
||||
failure(TLNetworkErrorTip);
|
||||
}
|
||||
}];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user