Commit 71db7491 by houweibin
parents 648e2a1b ab7f3920
......@@ -664,7 +664,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *) getExchangeRate:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMExchangeRateResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/exchange/rate",Additional_API_DOMAIN];
NSString *apiPath = [NSString stringWithFormat:@"https://%@/app/exchange/rate",Pay_API_DOMAIN];
// NSString *sign = [KWMStringUtil MD5:[KWMStringUtil BASE64:@"currency=EUR&key=bd3f58f5cd3d7a217ac8c8e655ab52f8"]];
// NSLog(@"rate sign: %@",sign);
// NSDictionary *params = @{@"currency":@"EUR",@"sign":sign};
......
......@@ -19,14 +19,18 @@
[routes addRoute:@"/collections/*" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
NSArray *tags = parameters[JLRouteWildcardComponentsKey];
NSLog(@"trace tags %@",[tags componentsJoinedByString:@","]);
KWMSelectedGoodsVC * selectedGoodsVC = (KWMSelectedGoodsVC *)[KWMBaseVC findControllerBy:[KWMSelectedGoodsVC kwmTag] fromStoryboard:@"New"];
selectedGoodsVC.ctags = tags;
[[AppDelegate mainViewController].selectedViewController pushViewController:selectedGoodsVC animated:YES];
return YES;
}];
[routes addRoute:@"/products/:id" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
NSLog(@"product id %@",parameters[@"id"]);
// KWMProductDetailVC *productDetailVC = (KWMProductDetailVC*)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
KWMProductDetailVC *productDetailVC = (KWMProductDetailVC*)[KWMBaseVC findControllerBy:[KWMProductDetailVC kwmTag] fromStoryboard:@"New"];
// productDetailVC.product = brandCell.leftProduct;
// productDetailVC.handle = parameters[@"id"];
// [[AppDelegate mainViewController].selectedViewController.navigationController pushViewController:productDetailVC animated:YES];
productDetailVC.handle = parameters[@"id"];
NSLog(@"%@",[AppDelegate mainViewController].selectedViewController);
[[AppDelegate mainViewController].selectedViewController pushViewController:productDetailVC animated:YES];
return YES;
}];
}
......
......@@ -64,7 +64,7 @@
[self initRecommendProduct];
// [self initShopCartCount];
//刷新product,如果是缓存的product,因为没有字典,所以会发生错误,需要重新请求一个有字典的product
if(!self.handle || (self.product && self.product.identifier && !self.product.JSONDictionary)){
if(self.handle || (self.product && self.product.identifier && !self.product.JSONDictionary)){
[self getProductBy:nil product:self.product];
}
NSArray *types = @[@"baby",@"girls",@"boys",@"shoes",@"newborn"];
......@@ -449,6 +449,7 @@
[self hideLoading];
if (product != nil && error == nil) {
self.product = product;
[self.productDetailView setData:product];
if(productId){
[self kwm_clickCollectionCell:product];
}
......@@ -464,5 +465,4 @@
}
}
@end
......@@ -32,7 +32,10 @@
@property (nonatomic) BOOL isLoading;
@property (strong, nonatomic) NSArray *ctags;
/**
* deeplink tags
*/
@property (strong, nonatomic) NSArray<NSString *>*ctags;
@property (nonatomic) KWMProductType *productType;
......
......@@ -52,6 +52,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
self.hasNextPage = NO;
self.collectionSort = BUYCollectionSortCreatedDescending;
if (self.ctags) {
self.title = self.ctags.firstObject.capitalizedString;
}else
if(self.productType != nil){
//初始化双行标题栏
NSString *mTitle;
......@@ -239,6 +242,38 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
- (void)requestProductList{
__weak KWMSelectedGoodsVC *weakSelf = self;
NSInteger tagetPage = self.currentPage.integerValue + 1;
void(^completion)(NSArray<BUYProduct *> *,NSUInteger,BOOL,NSError*) = ^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf hideLoading];
if(tagetPage == 1){
if(!products || products.count == 0){
self.vNoData.hidden = NO;
[weakSelf.dataList removeAllObjects];
[weakSelf.tbvSelectedGoods reloadData];
return;
}
}
weakSelf.isLoading = NO;
if (error == nil && products) {
self.vNoData.hidden = YES;
weakSelf.hasNextPage = !reachedEnd;
[weakSelf appendDataList:products setPage:page];
}
else {
[self showError:error];
NSLog(@"Error fetching products: %@", error);
}
};
if (self.ctags) {
[self.client getCollectionByHandle:self.ctags.lastObject completion:^(BUYCollection * _Nullable collection, NSError * _Nullable error) {
[self.client getProductsPage:tagetPage inCollection:collection.identifier withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion];
}];
// [self.client getProductsPage:tagetPage inCollection:nil withTags:self.ctags sortOrder:self.filterView.selectedSort completion:completion];
return;
}
NSNumber *collectionId;
if(self.collection!=nil){
collectionId = self.collection.identifier;
......@@ -269,36 +304,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
self.isLoading = YES;
__weak KWMSelectedGoodsVC *weakSelf = self;
NSInteger tagetPage = self.currentPage.integerValue + 1;
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf hideLoading];
if(tagetPage == 1){
if(tags.count == 1){
[weakSelf.userDao saveCollectionCache:products collectionId:collectionId tags:tags];
}
if(!products || products.count == 0){
self.vNoData.hidden = NO;
[weakSelf.dataList removeAllObjects];
[weakSelf.tbvSelectedGoods reloadData];
return;
}
}
weakSelf.isLoading = NO;
if (error == nil && products) {
self.vNoData.hidden = YES;
weakSelf.hasNextPage = !reachedEnd;
[weakSelf appendDataList:products setPage:page];
}
else {
[self showError:error];
NSLog(@"Error fetching products: %@", error);
}
}];
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:completion];
}
......
......@@ -660,6 +660,7 @@
return;
}
if(!result.code || result.code.integerValue != 1000){
NSLog(@"error: %@",result.message);
return;
}
NSString *alipayData = (NSString *)result.message;
......
......@@ -38,23 +38,20 @@
NSString *checkout_token = checkout.token;
NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
//先写test,后面改成正式的订单描述
NSString *subject = @"test";
#else
NSString *checkout_token = checkout.token;
//需要保留小数点后两位(包括小数点后的.00),以保持与后台一致,从而验证通过
NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
NSString *subject = [NSString stringWithFormat:@"CemaroseOrder-%@",checkout.token];
#endif
NSString *ip_address = @"127.0.0.1";
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&ip_address=%@&subject=%@&total_price=%@&key=%@",
checkout_token,ip_address,subject,total_price,User_Pay_KEY];
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&ip_address=%@&total_price=%@&key=%@",
checkout_token,ip_address,total_price,User_Pay_KEY];
NSString *base64String = [KWMStringUtil BASE64:before_sign];
NSString *sign = [KWMStringUtil MD5:base64String];
NSDictionary *parameters = @{
@"ip_address":ip_address,
@"checkout_token":checkout_token,
@"subject":subject,
@"total_price":total_price,
@"sign":sign
};
......@@ -66,21 +63,18 @@
#if DEBUG
NSString *checkout_token = checkout.token;
NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
NSString *subject = @"test";
#else
NSString *checkout_token = checkout.token;
//需要保留小数点后两位(包括小数点后的.00),以保持与后台一致,从而验证通过
NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
NSString *subject = [NSString stringWithFormat:@"CemaroseOrder-%@",checkout.token];
#endif
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&subject=%@&total_price=%@&key=%@",
checkout_token,subject,total_price,User_Pay_KEY];
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&total_price=%@&key=%@",
checkout_token,total_price,User_Pay_KEY];
NSString *base64String = [KWMStringUtil BASE64:before_sign];
NSString *sign = [KWMStringUtil MD5:base64String];
NSDictionary *parameters = @{
@"checkout_token":checkout_token,
@"subject":subject,
@"total_price":total_price,
@"sign":sign
};
......
......@@ -60,7 +60,7 @@
#define User_Pay_KEY @"bd3f58f5cd3d7a217ac8c8e655ab52f8"
#if DEBUG && 1
#if DEBUG && 0
//测试
#define TestModel @"YES"
......
......@@ -46,6 +46,14 @@
<string>cemarose</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>I</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017070509</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment