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
a1b63a16
Commit
a1b63a16
authored
Jun 02, 2017
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决一致性问题version版本
parent
5b9b3e13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
12 deletions
+33
-12
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+4
-5
KWMShoppingCart.m
iCemarose/Class/Model/KWMShoppingCart.m
+28
-7
KWMShopCartVC.m
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
+1
-0
No files found.
iCemarose/Class/Api/KWMAPIManager.h
View file @
a1b63a16
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
-
(
void
)
loginWebSuccess
:(
void
(
^
)())
success
failure
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
loginWebSuccess
:(
void
(
^
)())
success
failure
:
(
void
(
^
)(
NSError
*
error
))
failure
;
/**
/**
*
添加商品到购物车
*
立即购买使用
*
*
* @param variantId <#variantId description#>
* @param variantId <#variantId description#>
* @param quantity <#quantity description#>
* @param quantity <#quantity description#>
...
@@ -81,10 +81,9 @@
...
@@ -81,10 +81,9 @@
*
*
* @return <#return value description#>
* @return <#return value description#>
*/
*/
-
(
NSURLSessionDataTask
*
)
addProductWithVariantId
:(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMRequestResult
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
-
(
NSURLSessionDataTask
*
)
tmpCartWithVariantId
:(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSString
*
cartCookie
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
/**
*
立即购买使用
*
添加商品到购物车
*
*
* @param variantId <#variantId description#>
* @param variantId <#variantId description#>
* @param quantity <#quantity description#>
* @param quantity <#quantity description#>
...
@@ -93,7 +92,7 @@
...
@@ -93,7 +92,7 @@
*
*
* @return <#return value description#>
* @return <#return value description#>
*/
*/
-
(
NSURLSessionDataTask
*
)
tmpCartWithVariantId
:(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSString
*
cartCookie
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
-
(
NSURLSessionDataTask
*
)
addProductWithVariantId
:(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
success
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMRequestResult
*
result
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
/**
*
*
*
*
...
...
iCemarose/Class/Model/KWMShoppingCart.m
View file @
a1b63a16
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
@interface
KWMShoppingCart
()
@interface
KWMShoppingCart
()
@property
(
nonatomic
,
strong
)
KWMCartResult
*
result
;
@property
(
nonatomic
,
strong
)
KWMCartResult
*
result
;
@property
(
nonatomic
,
assign
)
CGFloat
version
;
@end
@end
...
@@ -54,19 +55,29 @@
...
@@ -54,19 +55,29 @@
}
}
-
(
void
)
allItemsWithCallback
:
(
ShoppingCartCallBack
)
callback
{
-
(
void
)
allItemsWithCallback
:
(
ShoppingCartCallBack
)
callback
{
CGFloat
version
=
[[
NSDate
date
]
timeIntervalSince1970
];
_version
=
version
;
__weak
typeof
(
self
)
this
=
self
;
[[
KWMAPIManager
sharedManager
]
getCartSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMAPIManager
sharedManager
]
getCartSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
if
(
version
==
this
.
version
)
{
callback
(
nil
,
result
);
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
callback
(
nil
,
result
);
}
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
callback
(
error
,
nil
);
callback
(
error
,
nil
);
}];
}];
}
}
-
(
void
)
increaseProductWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
callback
:
(
ShoppingCartCallBack
)
callback
{
-
(
void
)
increaseProductWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
callback
:
(
ShoppingCartCallBack
)
callback
{
CGFloat
version
=
[[
NSDate
date
]
timeIntervalSince1970
];
_version
=
version
;
__weak
typeof
(
self
)
this
=
self
;
[[
KWMAPIManager
sharedManager
]
addProductWithVariantId
:
variantId
quantity
:
quantity
success
:^
(
NSURLSessionDataTask
*
task
,
KWMRequestResult
*
result
)
{
[[
KWMAPIManager
sharedManager
]
addProductWithVariantId
:
variantId
quantity
:
quantity
success
:^
(
NSURLSessionDataTask
*
task
,
KWMRequestResult
*
result
)
{
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
if
(
version
==
this
.
version
)
{
// callback(error,cart);
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
}];
// callback(error,cart);
}];
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
// callback(error,nil);
}];
}];
...
@@ -74,9 +85,14 @@
...
@@ -74,9 +85,14 @@
}
}
-
(
void
)
changeProductWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
callback
:
(
ShoppingCartCallBack
)
callback
{
-
(
void
)
changeProductWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
callback
:
(
ShoppingCartCallBack
)
callback
{
CGFloat
version
=
[[
NSDate
date
]
timeIntervalSince1970
];
_version
=
version
;
__weak
typeof
(
self
)
this
=
self
;
[[
KWMAPIManager
sharedManager
]
changeProductWithVariantId
:
variantId
quantity
:
quantity
success
:^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMAPIManager
sharedManager
]
changeProductWithVariantId
:
variantId
quantity
:
quantity
success
:^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
// callback(nil,result);
// callback(nil,result);
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
// callback(error,nil);
}];
}];
...
@@ -84,9 +100,14 @@
...
@@ -84,9 +100,14 @@
}
}
-
(
void
)
updateProductWithVariantIds
:
(
NSArray
<
NSNumber
*>
*
)
variantIds
quantitties
:
(
NSArray
<
NSNumber
*>
*
)
quantites
callback
:
(
ShoppingCartCallBack
)
callback
{
-
(
void
)
updateProductWithVariantIds
:
(
NSArray
<
NSNumber
*>
*
)
variantIds
quantitties
:
(
NSArray
<
NSNumber
*>
*
)
quantites
callback
:
(
ShoppingCartCallBack
)
callback
{
CGFloat
version
=
[[
NSDate
date
]
timeIntervalSince1970
];
_version
=
version
;
__weak
typeof
(
self
)
this
=
self
;
[[
KWMAPIManager
sharedManager
]
updateProductWithVariantIds
:
variantIds
quantities
:
quantites
success
:^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMAPIManager
sharedManager
]
updateProductWithVariantIds
:
variantIds
quantities
:
quantites
success
:^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
// callback(nil,result);
// callback(nil,result);
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
// callback(error,nil);
}];
}];
...
...
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
View file @
a1b63a16
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
[
this
refresh
];
[
this
refresh
];
}];
}];
}
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
...
...
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