| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // NetHttpsManager+Store.m
- // BuguLive
- //
- // Created by qitewei on 2025/8/20.
- // Copyright © 2025 xfg. All rights reserved.
- //
- #import "NetHttpsManager+Store.h"
- #import "AFNetworking.h"
- #import "AFHTTPSessionManager+Singlton.h"
- @implementation NetHttpsManager (Store)
- - (void)storeGETWithPath:(NSString *)path SuccessBlock:(SuccessBlock)GetSuccess FailureBlock:(FailureBlock)GetFailure {
- NSMutableDictionary *headers = [self getHeader];
- NSString *url = [self URLWithPath:path];
- [self GETWithUrl:url headers:headers SuccessBlock:GetSuccess FailureBlock:GetFailure];
- }
- - (void)storePOSTWithPath:(NSString *)path paramDict:(NSMutableDictionary *)paramDict SuccessBlock:(SuccessBlock)PostSuccess FailureBlock:(FailureBlock)PostFailure {
-
- if (![NetWorkManager isExistenceNetwork])
- {
- NSLog(@"请检查当前网络");
- }
- else
- {
- NSString *urlStr = [self URLWithPath:path];
- paramDict = [NetWorkManager getLocalParm:paramDict url:urlStr];
-
- [NetWorkManager myCookieStorage];
-
- AFHTTPSessionManager *manager = [AFHTTPSessionManager defaultNetManager];
- manager.requestSerializer.timeoutInterval = 30;
- [manager POST:urlStr parameters:paramDict headers:[self getHeader] progress:^(NSProgress * _Nonnull uploadProgress) {
-
- } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
- // NSLog(@"responseObject");
- // NSLog(@"%@",responseObject);
- [NetWorkManager doResult:responseObject url:urlStr paramDict:paramDict successBlock:PostSuccess successBlock2:nil failureBlock:PostFailure failureBlock2:nil];
-
- } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
-
- [NetWorkManager updateErrorToServiceWithUrl:urlStr paramDict:paramDict errorString:[NSString stringWithFormat:@"%@",error]];
- if (PostFailure)
- {
- PostFailure(error);
- }
-
- }];
- }
- }
- - (NSString *)URLWithPath:(NSString *)path {
- NSString *domain = @"http://goods.dynasty168.com/shopapi/merchants";
- return [NSString stringWithFormat:@"%@%@", domain, path];
- }
- - (NSMutableDictionary *)getHeader {
- NSString *token = [BogoNetwork shareInstance].token ?: @"";
- NSMutableDictionary *headers = [[NSMutableDictionary alloc] initWithDictionary:@{
- @"token":token
- }];
-
- [NetWorkManager tryAddLangParamDict2:headers];
- return headers;
- }
- @end
|