Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
b6cd792d
Commit
b6cd792d
authored
Nov 27, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
所有订单api
parent
0f95b925
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
212 additions
and
31 deletions
+212
-31
project.pbxproj
iCemarose.xcodeproj/project.pbxproj
+6
-0
KWMOrderListResult.h
iCemarose/Class/Api/Cemarose/KWMOrderListResult.h
+28
-0
KWMOrderListResult.m
iCemarose/Class/Api/Cemarose/KWMOrderListResult.m
+50
-0
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+9
-0
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+43
-8
KWMCheckoutPayResult.m
iCemarose/Class/Api/KWMCheckoutPayResult.m
+3
-1
KWMBasePageVC.m
iCemarose/Class/UI/KWMBasePageVC.m
+3
-0
KWMOrderVC.m
iCemarose/Class/UI/Mine/KWMOrderVC.m
+70
-22
No files found.
iCemarose.xcodeproj/project.pbxproj
View file @
b6cd792d
...
...
@@ -84,6 +84,7 @@
C0028ECB1F0E2B3500744C14
/* KWMAdditionalListResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0028ECA1F0E2B3500744C14
/* KWMAdditionalListResult.m */
;
};
C00D40941F187C9500DEA685
/* KWMCategoryTitleView.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C00D40931F187C9500DEA685
/* KWMCategoryTitleView.xib */
;
};
C00D40971F187CAB00DEA685
/* KWMCategoryTitleView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C00D40961F187CAB00DEA685
/* KWMCategoryTitleView.m */
;
};
C01573F11FC7C674001ECACA
/* KWMOrderListResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
;
};
C0219A951DF53EB200711099
/* KWMExchangeRateResult.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0219A941DF53EB200711099
/* KWMExchangeRateResult.m */
;
};
C0243BBD1EFBD5A10013CFA7
/* Category.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0243BAF1EFBD5A10013CFA7
/* Category.storyboard */
;
};
C0243BBE1EFBD5A10013CFA7
/* KWMLeftCategoryCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C0243BB21EFBD5A10013CFA7
/* KWMLeftCategoryCell.m */
;
};
...
...
@@ -518,6 +519,8 @@
C00D40931F187C9500DEA685
/* KWMCategoryTitleView.xib */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.xib
;
path
=
KWMCategoryTitleView.xib
;
sourceTree
=
"<group>"
;
};
C00D40951F187CAB00DEA685
/* KWMCategoryTitleView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMCategoryTitleView.h
;
sourceTree
=
"<group>"
;
};
C00D40961F187CAB00DEA685
/* KWMCategoryTitleView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMCategoryTitleView.m
;
sourceTree
=
"<group>"
;
};
C01573EF1FC7C674001ECACA
/* KWMOrderListResult.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMOrderListResult.h
;
sourceTree
=
"<group>"
;
};
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMOrderListResult.m
;
sourceTree
=
"<group>"
;
};
C0219A931DF53EB200711099
/* KWMExchangeRateResult.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
KWMExchangeRateResult.h
;
sourceTree
=
"<group>"
;
};
C0219A941DF53EB200711099
/* KWMExchangeRateResult.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
KWMExchangeRateResult.m
;
sourceTree
=
"<group>"
;
};
C0243BAF1EFBD5A10013CFA7
/* Category.storyboard */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.storyboard
;
path
=
Category.storyboard
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1977,6 +1980,8 @@
9BE61D001ECD71610031D21E
/* KWMCartResult.m */
,
DA4E36901F1613C70007E4D0
/* KWMHomeDataResult.h */
,
DA4E36911F1613C70007E4D0
/* KWMHomeDataResult.m */
,
C01573EF1FC7C674001ECACA
/* KWMOrderListResult.h */
,
C01573F01FC7C674001ECACA
/* KWMOrderListResult.m */
,
);
path
=
Cemarose
;
sourceTree
=
"<group>"
;
...
...
@@ -2782,6 +2787,7 @@
807AF4A41DC984950000A326
/* KWMBrandsResult.m in Sources */
,
C048342B1F1324B400A5BFB4
/* KWMAdHeader.m in Sources */
,
C034E8471D6B10A0006EE129
/* UIColor+Extend.m in Sources */
,
C01573F11FC7C674001ECACA
/* KWMOrderListResult.m in Sources */
,
DA7457681F692D67000E192E
/* KWMProductSameBrandView.m in Sources */
,
C0DD53351EE55190002D1E0C
/* ArcToCircleLayer.m in Sources */
,
C091EE361DDEEA9400A382B9
/* KWMVariants.m in Sources */
,
...
...
iCemarose/Class/Api/Cemarose/KWMOrderListResult.h
0 → 100644
View file @
b6cd792d
//
// KWMOrderListResult.h
// iCemarose
//
// Created by HouWeiBin on 2017/11/24.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KWMCemaroseResult.h"
#import <JSONModel/JSONModel.h>
#import "Buy/Buy.h"
@interface
KWMOrderListResult
:
KWMCemaroseResult
//结果状态。success:正常;fail:错误
@property
(
nonatomic
)
NSString
<
Optional
>
*
status
;
//状态码
@property
(
nonatomic
)
NSNumber
<
Optional
>
*
code
;
//错误/成功提示
@property
(
nonatomic
)
NSString
<
Optional
>
*
message
;
//数据--存放解析后的model。
@property
(
nonatomic
)
id
<
Ignore
>
data
;
@end
iCemarose/Class/Api/Cemarose/KWMOrderListResult.m
0 → 100644
View file @
b6cd792d
//
// KWMOrderListResult.m
// iCemarose
//
// Created by HouWeiBin on 2017/11/24.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMOrderListResult.h"
@implementation
KWMOrderListResult
-
(
instancetype
)
initWithDictionary
:(
NSDictionary
*
)
dict
modelClass
:(
Class
)
modelClass
error
:(
NSError
**
)
err
{
self
=
[
super
initWithDictionary
:
dict
error
:
err
];
if
(
self
)
{
id
dataDict
=
dict
[
@"data"
];
if
(
modelClass
&&
dataDict
){
self
.
data
=
[
self
buildData
:
dataDict
];
}
}
return
self
;
}
-
(
id
)
buildData
:(
NSDictionary
*
)
jsonDictionary
{
id
result
=
nil
;
if
(
jsonDictionary
){
@try
{
NSArray
*
array
=
(
NSArray
*
)
jsonDictionary
;
if
(
array
){
// for(NSDictionary *dict in array){
BUYModelManager
*
modelManager
=
[[
BUYModelManager
alloc
]
init
];
result
=
[
modelManager
buy_objectsWithEntityName
:[
BUYOrder
entityName
]
JSONArray
:
array
];
// }
}
}
@catch
(
NSException
*
exception
){
NSLog
(
@"exception Name: %@"
,
exception
.
name
);
NSLog
(
@"exception Reason: %@"
,
exception
.
reason
);
}
}
return
result
;
}
+
(
JSONKeyMapper
*
)
keyMapper
{
return
[
JSONKeyMapper
mapperForSnakeCase
];
}
@end
iCemarose/Class/Api/KWMAPIManager.h
View file @
b6cd792d
...
...
@@ -39,6 +39,7 @@
#import "KWMWish.h"
#import "KWMHomeDataResult.h"
#import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
...
...
@@ -332,4 +333,12 @@
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMAdditionalListResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
* 获得所有订单 API
* @return NSURLSessionDataTask
*/
-
(
NSURLSessionDataTask
*
)
getOrderList
:(
NSDictionary
*
)
parameters
success
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
@end
iCemarose/Class/Api/KWMAPIManager.m
View file @
b6cd792d
...
...
@@ -20,6 +20,7 @@
#import "KWMBrandsTypeResult.h"
#import "KWMBrandsTypeModel.h"
#import "KWMDictionaryResult.h"
#import "KWMOrderListResult.h"
#import <RegexKitLite/RegexKitLite.h>
#import <SAMKeychain/SAMKeychain.h>
#import "KWMUserModel.h"
...
...
@@ -233,10 +234,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
-
(
AFHTTPSessionManager
*
)
buildSessionManager
{
return
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
];
return
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
isUseClientAuth
:
NO
];
}
-
(
AFHTTPSessionManager
*
)
buildSessionManager
:
(
BOOL
)
isJsonParameter
afSessionManage
:
(
AFHTTPSessionManager
*
)
afSessionManage
{
-
(
AFHTTPSessionManager
*
)
buildSessionManager
:
(
BOOL
)
isJsonParameter
afSessionManage
:
(
AFHTTPSessionManager
*
)
afSessionManage
isUseClientAuth
:
(
BOOL
)
isUseClientAuth
{
NSURL
*
url
=
[
NSURL
URLWithString
:
self
.
baseUrl
];
AFHTTPSessionManager
*
sessionManager
;
...
...
@@ -267,9 +268,24 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
else
{
[
sessionManager
.
requestSerializer
setAuthorizationHeaderFieldWithUsername
:
userName
password
:
password
];
}
id
tokenDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
];
if
(
tokenDict
){
BUYCustomerToken
*
token
=
[
BUYCustomerToken
customerTokenWithJSONDictionary
:
tokenDict
];
if
(
token
){
NSString
*
accessToken
=
token
.
accessToken
?:
@""
;
[
sessionManager
.
requestSerializer
setValue
:
accessToken
forHTTPHeaderField
:
@"X-Shopify-Customer-Access-Token"
];
}
}
if
(
isUseClientAuth
){
[
sessionManager
.
requestSerializer
setValue
:
@"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM=="
forHTTPHeaderField
:
@"Authorization"
];
}
return
sessionManager
;
}
-
(
BOOL
)
isUserClientAuth
:
(
Class
)
result
{
return
result
==
[
KWMOrderListResult
class
];
}
-
(
NSURLSessionDataTask
*
)
startSessionTask
:
(
KWMHTTPMethod
)
httpMethod
...
...
@@ -291,8 +307,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
||
result
==
[
KWMCheckoutPayResult
class
]
||
result
==
[
KWMCemaroseResult
class
]
||
[
result
isSubclassOfClass
:[
KWMCemaroseResult
class
]]),
@"result class must either be KWMRequestResult or KWMRequestListResult!"
);
NSAssert
((
!
model
||
(
model
&&
[
model
isSubclassOfClass
:[
JSONModel
class
]])),
@"model class must be sub class of JSONModel"
);
// NSAssert((!model || (model && [model isSubclassOfClass:[JSONModel class]])),
// @"model class must be sub class of JSONModel");
BOOL
isUseClientAuth
=
[
self
isUserClientAuth
:
result
];
//使用sessionManager请求时用到的callback
void
(
^
successCallback
)(
NSURLSessionDataTask
*
,
id
)
=
[
self
buildSuccessCallbackWithResultClass
:
result
modelClass
:
model
...
...
@@ -312,7 +329,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
//使用PPNetworkHelper请求失败时用到的callback
void
(
^
newFailedCallback
)(
NSError
*
error
)
=
[
self
buildNewFaliedCallback
:
failure
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
nil
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
nil
isUseClientAuth
:
isUseClientAuth
];
if
(
timeout
)
{
[
sessionManager
.
requestSerializer
setTimeoutInterval
:
timeout
];
}
...
...
@@ -332,7 +349,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
if
(
timeout
)
{
[
sessionManager
.
requestSerializer
setTimeoutInterval
:
timeout
];
}
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
sessionManager
];
[
self
buildSessionManager
:
isJsonParameter
afSessionManage
:
sessionManager
isUseClientAuth
:
isUseClientAuth
];
}];
if
(
filePaths
!=
nil
&&
filePaths
.
count
>
0
)
{
...
...
@@ -461,7 +478,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
modelClass
:
model
success
:
success
failure
:
failure
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
];
AFHTTPSessionManager
*
sessionManager
=
[
self
buildSessionManager
:
NO
afSessionManage
:
nil
isUseClientAuth
:
NO
];
NSString
*
method
=
httpMethod
==
KWMHTTPMethodPOST
?
@"POST"
:
@"GET"
;
NSURLRequest
*
request
=
[
sessionManager
.
requestSerializer
requestWithMethod
:
method
URLString
:
apiPath
parameters
:
parameters
error
:
nil
];
__block
id
task
=
[
sessionManager
dataTaskWithRequest
:
request
completionHandler
:
^
(
NSURLResponse
*
_Nonnull
response
,
id
_Nullable
responseObject
,
NSError
*
_Nullable
error
)
{
...
...
@@ -1131,7 +1148,25 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure
:
failure
];
}
/**
* 清空愿望单 API
* @param customer_id 用户ID
* @param customer_email 用户邮箱
* @param shop 店铺名(cemarose-test.myshopify.com)
*/
-
(
NSURLSessionDataTask
*
)
getOrderList
:
(
NSDictionary
*
)
parameters
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
{
NSString
*
apiPath
=
[
NSString
stringWithFormat
:
@"https://%@/customer/orders/custom-orders"
,
WishList_API_DOMAIN
];
apiPath
=
@"https://peter.tofnews.com/customer/orders/custom-orders"
;
return
[
self
startSessionTask
:
KWMHTTPMethodGET
apiPath
:
apiPath
parameters
:
parameters
result
:
[
KWMOrderListResult
class
]
model
:
[
BUYOrder
class
]
success
:
success
failure
:
failure
];
}
...
...
iCemarose/Class/Api/KWMCheckoutPayResult.m
View file @
b6cd792d
...
...
@@ -42,6 +42,8 @@
return
result
;
}
+
(
JSONKeyMapper
*
)
keyMapper
{
return
[
JSONKeyMapper
mapperFromUnderscoreCaseToCamelCase
];
}
@end
iCemarose/Class/UI/KWMBasePageVC.m
View file @
b6cd792d
...
...
@@ -162,6 +162,9 @@
//数据为空的时候显示Loading框
if
([
self
.
targetTableView
respondsToSelector
:
@selector
(
numberOfSections
)])
{
NSInteger
sectionCount
=
[
self
.
targetTableView
numberOfSections
];
if
(
sectionCount
==
0
){
[
super
showLoading
];
}
for
(
NSInteger
i
=
0
;
i
<
sectionCount
;
i
++
){
if
([
self
.
targetTableView
numberOfRowsInSection
:
i
]
<=
0
){
[
super
showLoading
];
...
...
iCemarose/Class/UI/Mine/KWMOrderVC.m
View file @
b6cd792d
...
...
@@ -11,13 +11,14 @@
#import "KWMNewProductVC.h"
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "MJRefresh.h"
@interface
KWMOrderVC
()
@property
(
nonatomic
)
NSMutableArray
*
productList
;
//订单商品列表
@property
(
nonatomic
)
NSMutableArray
*
expandOrderId
;
//标记展开的section
@end
@implementation
KWMOrderVC
{
NSMutableArray
*
expandOrderId
;
//标记展开的section
}
+
(
NSString
*
)
kwmTag
{
...
...
@@ -41,11 +42,11 @@
-
(
void
)
setUpData
{
self
.
productList
=
[
NSMutableArray
array
];
expandOrderId
=
[
NSMutableArray
array
];
self
.
expandOrderId
=
[
NSMutableArray
array
];
}
-
(
void
)
loadData
{
[
self
requestOrderAPI
];
[
self
request
New
OrderAPI
];
}
-
(
UITableView
*
)
targetTableView
{
...
...
@@ -101,8 +102,8 @@
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
if
(
arr
&&
arr
.
count
>
4
){
return
;
}
else
if
(
order
.
identifier
&&
!
[
expandOrderId
containsObject
:
order
.
identifier
]){
[
expandOrderId
addObject
:
order
.
identifier
];
}
else
if
(
order
.
identifier
&&
!
[
self
.
expandOrderId
containsObject
:
order
.
identifier
]){
[
self
.
expandOrderId
addObject
:
order
.
identifier
];
}
}
}
...
...
@@ -117,7 +118,7 @@
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
section
];
NSArray
<
BUYLineItem
*>
*
lineItems
=
[
order
.
lineItems
array
];
if
(
order
.
identifier
){
isExpend
=
[
expandOrderId
containsObject
:
order
.
identifier
];
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
if
(
!
lineItems
){
return
0
;
...
...
@@ -132,7 +133,7 @@
bool
isExpend
=
YES
;
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
indexPath
.
section
];
if
(
order
.
identifier
){
isExpend
=
[
expandOrderId
containsObject
:
order
.
identifier
];
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
NSInteger
rowCount
=
[
self
getRowCountBySection
:
indexPath
.
section
];
NSInteger
lastRow
=
rowCount
-
1
;
...
...
@@ -166,7 +167,7 @@
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
indexPath
.
section
];
if
(
order
.
identifier
){
isExpend
=
[
expandOrderId
containsObject
:
order
.
identifier
];
isExpend
=
[
self
.
expandOrderId
containsObject
:
order
.
identifier
];
}
NSArray
<
BUYLineItem
*>
*
arr
=
[
order
.
lineItems
array
];
if
(
!
arr
){
...
...
@@ -189,9 +190,9 @@
BUYOrder
*
order
=
[
self
.
dataList
objectAtIndex
:
markSection
];
if
(
order
.
identifier
){
if
(
showAll
)
{
[
expandOrderId
removeObject
:
order
.
identifier
];
[
self
.
expandOrderId
removeObject
:
order
.
identifier
];
}
else
{
[
expandOrderId
addObject
:
order
.
identifier
];
[
self
.
expandOrderId
addObject
:
order
.
identifier
];
}
}
[
self
.
tbvOrder
reloadData
];
...
...
@@ -210,29 +211,76 @@
-
(
void
)
kwm_onClickCancelOrder
:
(
BUYOrder
*
)
order
{
}
#pragma mark -- API
//获取订单API
-
(
void
)
requestOrderAPI
{
//获取
全部
订单API
-
(
void
)
request
New
OrderAPI
{
[
self
showLoading
];
__weak
KWMOrderVC
*
weakSelf
=
self
;
self
.
client
.
customerToken
=
[
BUYCustomerToken
customerTokenWithJSONDictionary
:[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
]];
[
self
.
client
getOrdersForCustomerCallback
:
^
(
NSArray
<
BUYOrder
*>
*
_Nullable
orders
,
NSError
*
_Nullable
error
)
{
NSInteger
targetPage
=
self
.
currentPage
.
integerValue
+
1
;
self
.
tbvOrder
.
mj_footer
.
hidden
=
YES
;
NSDictionary
*
parameters
=
@{
@"page"
:
@
(
targetPage
).
stringValue
};
[
self
.
api
getOrderList
:
parameters
success
:
^
(
NSURLSessionDataTask
*
task
,
KWMOrderListResult
*
result
)
{
[
weakSelf
hideLoading
];
NSMutableArray
*
showOrders
=
[
NSMutableArray
arrayWithArray
:
orders
];
if
(
error
==
nil
&&
orders
!=
nil
)
{
if
(
!
result
.
code
||
result
.
code
.
integerValue
!=
1000
){
if
(
result
.
message
){
[
weakSelf
showToast
:
result
.
message
];
}
return
;
}
if
(
result
.
data
)
{
NSMutableArray
*
showOrders
=
[
NSMutableArray
arrayWithArray
:
result
.
data
];
BUYOrder
*
paidOrder
=
[
self
getPaidOrder
];
if
(
paidOrder
){
if
(
paidOrder
&&
targetPage
==
1
){
[
showOrders
insertObject
:
paidOrder
atIndex
:
0
];
}
[
weakSelf
.
dataList
removeAllObjects
];
if
(
showOrders
.
count
<=
50
){
weakSelf
.
hasNextPage
=
false
;
weakSelf
.
tbvOrder
.
mj_footer
.
hidden
=
YES
;
}
else
{
weakSelf
.
hasNextPage
=
false
;
weakSelf
.
tbvOrder
.
mj_footer
.
hidden
=
NO
;
}
if
(
showOrders
.
count
==
0
||
targetPage
==
1
){
[
weakSelf
.
dataList
removeAllObjects
];
[
self
.
expandOrderId
removeAllObjects
];
}
[
weakSelf
refreshOpenSection
:
showOrders
];
[
weakSelf
appendDataList
:
showOrders
setPage
:
1
];
weakSelf
.
hasNextPage
=
false
;
[
weakSelf
requestProductsApi
];
}
else
if
(
error
!=
nil
){
[
weakSelf
showError
:
error
];
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
[
weakSelf
hideLoading
];
[
weakSelf
showError
:
error
];
}];
}
//获取订单API
-
(
void
)
requestOrderAPI
{
// [self showLoading];
__weak
KWMOrderVC
*
weakSelf
=
self
;
self
.
client
.
customerToken
=
[
BUYCustomerToken
customerTokenWithJSONDictionary
:[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
]];
[
self
.
client
getOrdersForCustomerCallback
:
^
(
NSArray
<
BUYOrder
*>
*
_Nullable
orders
,
NSError
*
_Nullable
error
)
{
// [weakSelf hideLoading];
// NSMutableArray *showOrders = [NSMutableArray arrayWithArray:orders];
// if (error == nil && orders != nil ) {
// BUYOrder *paidOrder = [self getPaidOrder];
// if(paidOrder){
// [showOrders insertObject:paidOrder atIndex:0];
// }
// [weakSelf.dataList removeAllObjects];
// [weakSelf refreshOpenSection:showOrders];
// [weakSelf appendDataList:showOrders setPage:1];
// weakSelf.hasNextPage = false;
// [weakSelf requestProductsApi];
// }else if (error != nil){
// [weakSelf showError:error];
// }
}];
}
...
...
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