Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMNetService
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMNetService
Commits
a433ae95
Commit
a433ae95
authored
May 31, 2016
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除没有必要的新代码
parent
1e9fea67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
83 deletions
+0
-83
WMNetService.h
GMNetService/Classes/WMNetService.h
+0
-18
WMNetService.m
GMNetService/Classes/WMNetService.m
+0
-65
No files found.
GMNetService/Classes/WMNetService.h
View file @
a433ae95
...
...
@@ -34,24 +34,6 @@
@property
(
nonatomic
,
strong
)
NSString
*
urlCommonParameters
;
+
(
instancetype
)
shareInstance
;
+
(
void
)
sendRequestWithURLString
:(
NSString
*
)
URLString
parameters
:(
nullable
id
)
parameters
method
:(
HttpMethod
)
method
responseJSON
:(
nullable
void
(
^
)(
NSDictionary
*
_Nullable
dic
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:(
nullable
ResultFailed
)
failed
;
+
(
void
)
sendRequestWithURLString
:(
NSString
*
)
URLString
parameters
:(
nullable
id
)
parameters
method
:(
HttpMethod
)
method
responseList
:(
nullable
void
(
^
)(
NSArray
*
_Nullable
data
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:(
nullable
ResultFailed
)
failed
;
+
(
void
)
sendRequestWithURLString
:(
NSString
*
)
URLString
parameters
:(
nullable
id
)
parameters
method
:(
HttpMethod
)
method
responseString
:(
nullable
void
(
^
)(
NSString
*
_Nullable
string
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:(
nullable
ResultFailed
)
failed
;
/**
* @author licong, 15-11-19 12:11:09
*
...
...
GMNetService/Classes/WMNetService.m
View file @
a433ae95
...
...
@@ -23,71 +23,6 @@
return
instance
;
}
+
(
void
)
sendRequestWithURLString
:
(
NSString
*
)
URLString
parameters
:
(
nullable
id
)
parameters
method
:
(
HttpMethod
)
method
responseJSON
:
(
nullable
void
(
^
)(
NSDictionary
*
_Nullable
dic
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:
(
nullable
ResultFailed
)
failed
{
[
self
send
:
URLString
parameters
:
parameters
method
:
method
responseList
:
success
failed
:
failed
];
}
+
(
void
)
sendRequestWithURLString
:
(
NSString
*
)
URLString
parameters
:
(
nullable
id
)
parameters
method
:
(
HttpMethod
)
method
responseList
:
(
nullable
void
(
^
)(
NSArray
*
_Nullable
data
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:
(
nullable
ResultFailed
)
failed
{
[
self
send
:
URLString
parameters
:
parameters
method
:
method
responseList
:
success
failed
:
failed
];
}
+
(
void
)
sendRequestWithURLString
:
(
NSString
*
)
URLString
parameters
:
(
nullable
id
)
parameters
method
:
(
HttpMethod
)
method
responseString
:
(
nullable
void
(
^
)(
NSString
*
_Nullable
string
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:
(
nullable
ResultFailed
)
failed
{
[
self
send
:
URLString
parameters
:
parameters
method
:
method
responseList
:
success
failed
:
failed
];
}
+
(
void
)
send
:
(
NSString
*
)
URLString
parameters
:
(
nullable
id
)
parameters
method
:
(
HttpMethod
)
method
responseList
:
(
nullable
void
(
^
)(
id
_Nullable
data
,
NSString
*
_Nullable
message
,
APIStatusCode
error
))
success
failed
:
(
nullable
ResultFailed
)
failed
{
void
(
^
AFSuccess
)
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
=
^
(
NSURLSessionDataTask
*
task
,
id
responseObject
)
{
[
UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
NO
;
success
(
responseObject
[
@"data"
],
responseObject
[
@"message"
],
[
responseObject
[
@"error"
]
integerValue
]);
};
void
(
^
AFFailure
)
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
=
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
[
UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
NO
;
NSHTTPURLResponse
*
response
=
(
NSHTTPURLResponse
*
)
task
.
response
;
NSURLRequest
*
request
=
task
.
originalRequest
;
NSInteger
statusCode
=
response
.
statusCode
;
NSString
*
errorStr
=
[
NSString
stringWithFormat
:
@"%@ %ld: %@ %@"
,
request
.
URL
.
path
,
(
long
)
statusCode
,
[
error
localizedFailureReason
],
[
error
localizedDescription
]];
if
(
statusCode
==
HttpStatusCodeUnauthorized
){
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:[
WMNetService
shareInstance
].
loginExpiredName
object
:
nil
];
}
else
{
debugLog
(
@"WMNetService %@"
,
errorStr
);
}
failed
(
errorStr
);
};
[
UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
YES
;
NSString
*
resultURLString
=
[
URLString
stringByAppendingString
:[
WMNetService
shareInstance
].
urlCommonParameters
];
if
(
method
==
HttpMethodGet
)
{
[[
WMNetService
shareInstance
].
networking
GET
:
resultURLString
parameters
:
parameters
success
:
AFSuccess
failure
:
AFFailure
];
}
else
if
(
method
==
HttpMethodPost
){
[[
WMNetService
shareInstance
].
networking
POST
:
resultURLString
parameters
:
parameters
success
:
AFSuccess
failure
:
AFFailure
];
}
else
if
(
method
==
HttpMethodDelete
){
[[
WMNetService
shareInstance
].
networking
DELETE
:
resultURLString
parameters
:
parameters
success
:
AFSuccess
failure
:
AFFailure
];
}
else
if
(
method
==
HttpMethodPatch
){
[[
WMNetService
shareInstance
].
networking
PATCH
:
resultURLString
parameters
:
parameters
success
:
AFSuccess
failure
:
AFFailure
];
}
else
if
(
method
==
HttpMethodPut
){
[[
WMNetService
shareInstance
].
networking
PUT
:
resultURLString
parameters
:
parameters
success
:
AFSuccess
failure
:
AFFailure
];
}
}
#pragma mark - Method Decrepeted
-
(
void
)
sendRequestWithURLString
:
(
NSString
*
)
URLString
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment