65 lines
1.9 KiB
Objective-C
65 lines
1.9 KiB
Objective-C
//
|
|
// HttpRequestHelper.h
|
|
// YUMI
|
|
//
|
|
// Created by zu on 2021/9/3.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "BaseModel.h"
|
|
|
|
typedef NS_ENUM(NSUInteger, HttpRequestHelperMethod) {
|
|
HttpRequestHelperMethodPOST,
|
|
HttpRequestHelperMethodGET,
|
|
HttpRequestHelperMethodDELETE
|
|
};
|
|
|
|
static dispatch_once_t onceToken;
|
|
|
|
typedef void(^HttpRequestHelperCompletion)(BaseModel* _Nullable data, NSInteger code, NSString * _Nullable msg);
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface HttpRequestHelper : NSObject
|
|
+(NSString *)getHostUrl;
|
|
+ (NSDictionary*)configBaseParmars:(NSDictionary * _Nullable)parmars;
|
|
|
|
+ (void)GET:(NSString *)method
|
|
params:(NSDictionary *)params
|
|
success:(void (^)(BaseModel *data))success
|
|
failure:(void (^)(NSInteger resCode, NSString *message))failure;
|
|
|
|
+ (void)POST:(NSString *)method
|
|
params:(NSDictionary *)params
|
|
success:(void (^)(BaseModel *data))success
|
|
failure:(void (^)(NSInteger resCode, NSString *message))failure;
|
|
|
|
+ (void)DELETE:(NSString *)method
|
|
params:(NSDictionary *)params
|
|
success:(void (^)(BaseModel *data))success
|
|
failure:(void (^)(NSInteger resCode, NSString *message))failure;
|
|
|
|
+ (void)request:(NSString *)url
|
|
method:(HttpRequestHelperMethod)method
|
|
params:(NSDictionary *)params
|
|
success:(void (^)(BaseModel *data))success
|
|
failure:(void (^)(NSInteger resCode, NSString *message))failure;
|
|
|
|
+ (void)request:(NSString *)path
|
|
method:(HttpRequestHelperMethod)method
|
|
params:(NSDictionary *)params
|
|
completion:(HttpRequestHelperCompletion)completion;
|
|
|
|
|
|
/// 增加或编辑技能卡专用接口 Post 请求参数放入到 body 里 使用 application/json 类型传递
|
|
/// @param path 请求地址
|
|
/// @param params 参数
|
|
/// @param completion 回调
|
|
+ (void)postSkillCard:(NSString *)path
|
|
params:(NSString *)params
|
|
completion:(HttpRequestHelperCompletion)completion;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|