1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //
- // ASHomeViewModel.m
- // Asteria
- //
- // Created by iOS on 2024/5/16.
- //
- #import "ASHomeViewModel.h"
- @implementation ASHomeViewModel
- - (NSMutableArray<ASJumpModel *> *)banners {
- if (!_banners) {
- NSMutableArray *arr = [NSMutableArray array];
- _banners = arr;
- }
- return _banners;
- }
- - (NSMutableArray<ASJumpModel *> *)categorys {
- if (!_categorys) {
- NSMutableArray *arr = [NSMutableArray array];
- _categorys = arr;
- }
- return _categorys;
- }
- -(void)getHomeTopData:(btnClickBlock)success {
- __weak typeof(self) weakSelf = self;
- [ASNetTools.shared getMsgWithPath:homeTop param:@{} success:^(id _Nonnull json) {
- NSLog(@"------url:%@---json:%@------", getHotList, json);
- NSMutableArray *arr = [ASJumpModel mj_objectArrayWithKeyValuesArray:json[@"banner"]];
- weakSelf.banners = arr;
- NSMutableArray *cateArr = [ASJumpModel mj_objectArrayWithKeyValuesArray:json[@"category"]];
- weakSelf.banners = arr;
- weakSelf.categorys = cateArr;
- success();
- } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
- NSLog(@"------url:%@---code:%@---msg:%@---", getHotList, code, msg);
- weakSelf.banners = [NSMutableArray array];
- weakSelf.categorys = [NSMutableArray array];
- success();
- }];
- }
- @end
|