if (json[@"banners"]) {
NSArray *images = [WKParserUtil array:json key:@"banners"];
[newObject createAttribute:@"banners" data:images];
}
if (json[@"productimgs"]) {
NSArray *images = [WKParserUtil array:json key:@"productimgs"];
NSMutableArray *productImages = [NSMutableArray arrayWithCapacity:images.count];
[images enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:images.count];
if ([UIScreen mainScreen].scale == 2.f ) {
dic[@"height"] = @([obj[@"img_height"] floatValue]/2);
}else if ([UIScreen mainScreen].scale == 3.f )
{
dic[@"height"] = @([obj[@"img_height"] floatValue]/3);
}
dic[@"wight"] = obj[@"img_width"];
NSString *imageUrl = [LEJAppUtil spliceSouurceUrlBySize:CGSizeMake(SCREEN_WIDTH, [obj[@"img_height"] floatValue]) url:obj[@"imgurl"]];
dic[@"imageUrl"] = imageUrl;
[productImages addObject:dic];
}];
[newObject createAttribute:@"productImages" data:productImages];
}
NSArray *images = [WKParserUtil array:json key:@"banners"];
[newObject createAttribute:@"banners" data:images];
}
if (json[@"productimgs"]) {
NSArray *images = [WKParserUtil array:json key:@"productimgs"];
NSMutableArray *productImages = [NSMutableArray arrayWithCapacity:images.count];
[images enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithCapacity:images.count];
if ([UIScreen mainScreen].scale == 2.f ) {
dic[@"height"] = @([obj[@"img_height"] floatValue]/2);
}else if ([UIScreen mainScreen].scale == 3.f )
{
dic[@"height"] = @([obj[@"img_height"] floatValue]/3);
}
dic[@"wight"] = obj[@"img_width"];
NSString *imageUrl = [LEJAppUtil spliceSouurceUrlBySize:CGSizeMake(SCREEN_WIDTH, [obj[@"img_height"] floatValue]) url:obj[@"imgurl"]];
dic[@"imageUrl"] = imageUrl;
[productImages addObject:dic];
}];
[newObject createAttribute:@"productImages" data:productImages];
}