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