12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // FKWantBuyReform.m
- // FirstLink
- //
- // Created by 施昌鹏 on 16/8/18.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKWantBuyReform.h"
- #import "FKWantBuyItem.h"
- #import "FKWantBuyProItem.h"
- @implementation FKWantBuyReform
- +(NSString *)pareserStorageNumber:(NSDictionary *)dict {
- if ([dict[@"data"][@"list"] isKindOfClass:[NSDictionary class]]) {
- return [NSString stringWithFormat:@"%@",dict[@"data"][@"list"][@"storage_number"]];
- }
- return nil;
- }
- + (NSString *)parseStatus:(NSDictionary *)dict targetURL:(NSString *)targetURL {
- if ([dict[@"data"] isKindOfClass:[NSDictionary class]] && targetURL) {
- NSURL *url = [NSURL URLWithString:targetURL];
- if (url) {
- for (NSString *key in [dict[@"data"] allKeys]) {
- if ([key containsString:url.path]) {
- NSNumber *number = dict[@"data"][key];
- return [NSString stringWithFormat:@"%@", number];
- }
- }
- }
- }
- return nil;
- }
- + (NSInteger)pareserTotalCount:(NSDictionary *)dict {
- if ([dict[@"data"][@"pager"] isKindOfClass:[NSDictionary class]]) {
- NSNumber *number = dict[@"data"][@"pager"][@"total"];
- if ([number isKindOfClass:[NSNumber class]]) {
- return number.integerValue;
- }
- }
- return 0;
- }
- +(NSMutableArray *)parserWantBuyDetailWithDict:(NSDictionary *)dict {
- if (![dict isKindOfClass:[NSDictionary class]]) return nil;
-
- NSArray *dataArray = dict[@"data"][@"list"];
- if ([dataArray isKindOfClass:[NSArray class]] && dataArray.count > 0) {
- NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:dataArray.count];
- for (NSDictionary *itemDict in dataArray) {
- FKWantBuyItem *item = [[FKWantBuyItem alloc] init];
- [item mts_setValuesForKeysWithDictionary:itemDict];
- [arrayM addObject:item];
- }
- return arrayM;
- }
- return nil;
- }
- @end
|