IndustryCategoryModel.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // IndustryCategoryModel.m
  3. // BuguLive
  4. //
  5. // Created by qitewei on 2025/8/20.
  6. // Copyright © 2025 xfg. All rights reserved.
  7. //
  8. #import "IndustryCategoryModel.h"
  9. @implementation IndustryCategoryModel
  10. - (instancetype)initWithDictionary:(NSDictionary *)dict {
  11. self = [super init];
  12. if (self) {
  13. _categoryId = [dict[@"id"] integerValue];
  14. _name = dict[@"name"] ?: @"";
  15. _depositAmount = dict[@"deposit_amount"] ?: @"0.00";
  16. _commissionRate = dict[@"commission_rate"] ?: @"0.00";
  17. _createTime = [dict[@"create_time"] doubleValue];
  18. _createTimeText = dict[@"create_time_text"] ?: @"";
  19. }
  20. return self;
  21. }
  22. + (NSArray<IndustryCategoryModel *> *)modelsFromArray:(NSArray *)array {
  23. NSMutableArray *models = [NSMutableArray array];
  24. for (NSDictionary *dict in array) {
  25. if ([dict isKindOfClass:[NSDictionary class]]) {
  26. IndustryCategoryModel *model = [[IndustryCategoryModel alloc] initWithDictionary:dict];
  27. [models addObject:model];
  28. }
  29. }
  30. return [models copy];
  31. }
  32. @end