| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | 
							- //
 
- //  ASPointsViewModel.m
 
- //  Asteria
 
- //
 
- //  Created by iOS on 2023/12/2.
 
- //
 
- #import "ASPointsViewModel.h"
 
- @implementation ASPointsViewModel
 
- - (instancetype)init
 
- {
 
-     self = [super init];
 
-     if (self) {
 
-         self.allList = [NSMutableArray array];
 
-         self.usedList = [NSMutableArray array];
 
-         self.extraPathList = [NSMutableArray array];
 
-     }
 
-     return self;
 
- }
 
- - (void)getExtraList:(void(^)(BOOL hasNext, NSString *msg))com {
 
-     __weak typeof(self) weakSelf = self;
 
-     NSMutableDictionary *dic = [NSMutableDictionary dictionary];
 
-     [ASNetTools.shared getWithPath:getExtraPoints param:dic success:^(id _Nonnull json) {
 
-         NSMutableArray *arr = [ASExtraPointsModel mj_objectArrayWithKeyValuesArray:json];
 
-         weakSelf.extraPathList = arr;
 
-         com(true, @"");
 
-     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
 
-         com(false, msg);
 
-     }];
 
- }
 
- - (void)getAllList:(NSInteger)page com:(void(^)(BOOL hasNext, NSString *msg))com {
 
-     NSMutableDictionary *dic = [NSMutableDictionary dictionary];
 
-     dic[@"page"] = [NSString stringWithFormat:@"%ld", page];
 
-     dic[@"obtained"] = @"0";
 
-     dic[@"used"] = @"0";
 
-     [ASNetTools.shared getWithPath:getPointsDetailUrl param:dic success:^(id _Nonnull json) {
 
-         NSInteger pagesize = [NSString stringWithFormat:@"%@", json[@"pageSize"]].integerValue;
 
-         NSArray *list = json[@"list"];
 
-         NSMutableArray *arr = [ASPointDetailModel mj_objectArrayWithKeyValuesArray:list];
 
-         if (page == 1) {
 
-             self.allList = arr;
 
-         } else {
 
-             [self.allList addObjectsFromArray:arr];
 
-         }
 
-         if (arr.count >= pagesize){
 
-             com(true, @"");
 
-         } else {
 
-             com(false, @"");
 
-         }
 
-     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
 
-         com(false, msg);
 
-     }];
 
- }
 
- - (void)getUsedList:(NSInteger)page com:(void(^)(BOOL hasNext, NSString *msg))com{
 
-     NSMutableDictionary *dic = [NSMutableDictionary dictionary];
 
-     dic[@"page"] = [NSString stringWithFormat:@"%ld", page];
 
-     dic[@"used"] = @"1";
 
-     dic[@"obtained"] = @"0";
 
-     [ASNetTools.shared getWithPath:getPointsDetailUrl param:dic success:^(id _Nonnull json) {
 
-         NSInteger pagesize = [NSString stringWithFormat:@"%@", json[@"pageSize"]].integerValue;
 
-         NSArray *list = json[@"list"];
 
-         NSMutableArray *arr = [ASPointDetailModel mj_objectArrayWithKeyValuesArray:list];
 
-         if (page == 1) {
 
-             self.usedList = arr;
 
-         } else {
 
-             [self.usedList addObjectsFromArray:arr];
 
-         }
 
-         if (arr.count >= pagesize){
 
-             com(true, @"");
 
-         } else {
 
-             com(false, @"");
 
-         }
 
-     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
 
-         com(false, msg);
 
-     }];
 
- }
 
- @end
 
 
  |