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
d9abf67a
Commit
d9abf67a
authored
Jun 06, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.oschina.net/kollway-kollway/newcemarose
parents
76309da3
c8043a7c
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 @
d9abf67a
...
...
@@ -72,7 +72,7 @@
-
(
void
)
loginWebSuccess
:(
void
(
^
)())
success
failure
:
(
void
(
^
)(
NSError
*
error
))
failure
;
/**
*
添加商品到购物车
*
立即购买使用
*
* @param variantId <#variantId description#>
* @param quantity <#quantity description#>
...
...
@@ -81,10 +81,9 @@
*
* @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 quantity <#quantity description#>
...
...
@@ -93,7 +92,7 @@
*
* @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 @
d9abf67a
...
...
@@ -13,6 +13,7 @@
@interface
KWMShoppingCart
()
@property
(
nonatomic
,
strong
)
KWMCartResult
*
result
;
@property
(
nonatomic
,
assign
)
CGFloat
version
;
@end
...
...
@@ -54,19 +55,29 @@
}
-
(
void
)
allItemsWithCallback
:
(
ShoppingCartCallBack
)
callback
{
CGFloat
version
=
[[
NSDate
date
]
timeIntervalSince1970
];
_version
=
version
;
__weak
typeof
(
self
)
this
=
self
;
[[
KWMAPIManager
sharedManager
]
getCartSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
callback
(
nil
,
result
);
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
callback
(
nil
,
result
);
}
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
callback
(
error
,
nil
);
}];
}
-
(
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
)
{
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
// callback(error,cart);
}];
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
// callback(error,cart);
}];
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
}];
...
...
@@ -74,9 +85,14 @@
}
-
(
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
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
// callback(nil,result);
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
}];
...
...
@@ -84,9 +100,14 @@
}
-
(
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
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
if
(
version
==
this
.
version
)
{
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
// callback(nil,result);
}
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
// callback(error,nil);
}];
...
...
iCemarose/Class/UI/ShopCart/KWMShopCartVC.m
View file @
d9abf67a
...
...
@@ -53,6 +53,7 @@
[[
KWMShoppingCart
sharedInstance
]
allItemsWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
[
this
refresh
];
}];
}
-
(
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