KWSearchViewModel.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // KWSearchViewModel.m
  3. // westkissMob
  4. //
  5. // Created by iOS on 2022/9/20.
  6. //
  7. #import "KWSearchViewModel.h"
  8. #import "KWSearchSubTypeModel.h"
  9. @implementation KWSearchViewModel
  10. - (void)switchCurrencie:(KWSubTypeSectionModel *)m callback:(void(^)(BOOL flag))success {
  11. // NSMutableDictionary *paraDic = [NSMutableDictionary dictionary];
  12. // paraDic[@"currency"] = m.Id;
  13. //// @weakify(self);
  14. // [PPNetworkHelper POST:SwitchCurrencies parameters:paraDic success:^(id responseObject) {
  15. // if (RequestSuccess) {
  16. // NSLog(@"success:%@",responseObject);
  17. // [PPNetworkCache removeAllHttpCache];
  18. success(true);
  19. // } else {
  20. // NSLog(@"fail:%@",RequestErrorMsg);
  21. // success(false);
  22. // }
  23. // } failure:^(NSError *error) {
  24. // NSLog(@"err:%@",error);
  25. // success(false);
  26. // }];
  27. }
  28. - (void)reqCurrenciesList:(btnClickBlock)success {
  29. // NSMutableDictionary *paraDic = [NSMutableDictionary dictionary];
  30. // @weakify(self);
  31. // [PPNetworkHelper POST:GetCurrencies parameters:paraDic success:^(id responseObject) {
  32. // if (RequestSuccess) {
  33. // NSLog(@"success:%@",responseObject);
  34. // NSArray *arr = (NSArray *)responseObject[@"data"];
  35. // NSMutableArray *subArr = [[NSMutableArray alloc] init];
  36. // for (NSDictionary *dic in arr) {
  37. // NSString *name = dic[@"name"];
  38. // NSString *short_name = dic[@"short_name"];
  39. // NSNumber *status = dic[@"status"];
  40. //
  41. // KWSubTypeSectionModel *m = [[KWSubTypeSectionModel alloc] init];
  42. // m.Id = short_name;
  43. // m.title = name;
  44. // m.isOpen = status.boolValue;
  45. // m.isMoneyType = true;
  46. // m.children = [[NSMutableArray alloc] init];
  47. // [subArr addObject:m];
  48. // }
  49. //
  50. // KWMainTypeModel *model = [KWMainTypeModel new];
  51. // model.title = @"CURRENCY";
  52. // model.isMoneyType = true;
  53. // model.children = subArr;
  54. // weak_self.moneyType = model;
  55. // success();
  56. // } else {
  57. // NSLog(@"fail:%@",RequestErrorMsg);
  58. // success();
  59. // }
  60. // } failure:^(NSError *error) {
  61. // NSLog(@"err:%@",error);
  62. success();
  63. // }];
  64. }
  65. - (void)reqProductTypeList: (btnClickBlock)success {
  66. // NSString *url = SearchType;//[NSString stringWithFormat:@"%@%@",Formal_Server,SearchType];
  67. // NSMutableDictionary *paraDic = [NSMutableDictionary dictionary];
  68. // @weakify(self);
  69. // [PPNetworkHelper POST:url parameters:paraDic responseCache:^(id responseObject) {
  70. // if (RequestSuccess) {
  71. // NSLog(@"success:%@",responseObject);
  72. //
  73. // NSMutableArray *arr = [KWMainTypeModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"]];
  74. // weak_self.arr = arr;
  75. // if (arr.count > 0 ) {
  76. success();
  77. // }
  78. // }
  79. // } success:^(id responseObject) {
  80. // if (RequestSuccess) {
  81. // NSLog(@"success:%@",responseObject);
  82. //
  83. // NSArray *arr = [KWMainTypeModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"]];
  84. // weak_self.arr = arr;
  85. // success();
  86. // } else {
  87. // NSLog(@"fail:%@",RequestErrorMsg);
  88. // weak_self.arr = @[];
  89. // success();
  90. // }
  91. // } failure:^(NSError *error) {
  92. // NSLog(@"err:%@",error);
  93. // weak_self.arr = @[];
  94. // success();
  95. // } isSetToken:false];
  96. }
  97. @end