// // KXMainPageViewModel.m // CAISHEN // // Created by kuxuan on 2017/8/25. // Copyright © 2017年 kuxuan. All rights reserved. // #import "KXMainPageViewModel.h" #import "KXLoanAllModel.h" #import "KXRecommnedModel.h" #import "KXVerticleModel.h" @implementation KXMainPageViewModel + (void)loanAllLabelName:(void (^)(id json))success { NSString *urlString=[NSString stringWithFormat:@"%@/category/list",URL]; [KXHTTP post:urlString params:nil success:^(id json) { NSArray *array=[NSArray yy_modelArrayWithClass:[KXLoanAllModel class] json:json]; success(array); } failure:^(NSError *error) { }]; } + (void)getAdAlertUrl:(void (^)(KXLaunchModel *model))launch { NSString *urlString = [NSString stringWithFormat:@"%@/advert/getAlertAdvertRand",URL]; [KXHTTP post:urlString params:nil success:^(id json) { KXLaunchModel *model = [KXLaunchModel yy_modelWithJSON:json[@"data"]]; launch(model); } failure:^(NSError *error) { }]; } + (void)recommendData:(NSDictionary *)para data:(void(^)(NSArray *dataSource))data { NSString *urlString = [NSString stringWithFormat:@"%@/product/getSameAmountByProductId",URL]; [KXHTTP post:urlString params:para success:^(id json) { NSArray *array = [NSArray yy_modelArrayWithClass:[KXRecommnedModel class] json:json[@"data"]]; data(array); } failure:^(NSError *error) { }]; } + (void)requestVerticleViewData:(void (^)(NSArray *notice))notice { NSString *urlString = [NSString stringWithFormat:@"%@/homeact/getNoticeList",URL]; [KXHTTP post:urlString params:nil success:^(id json) { NSArray *array = [NSArray yy_modelArrayWithClass:[KXVerticleModel class] json:json[@"data"]]; notice(array); } failure:^(NSError *error) { }]; } +(void)requestVerticleHuaJiangHu:(void (^)(NSArray *))notice { // https://newapi.henhaojie.com/user/homeact/getNoticeList NSString *urlString = [NSString stringWithFormat:@"%@/homeact/getNoticeList",URL]; [KXHTTP post:urlString params:nil success:^(id json) { NSArray *array = [NSArray yy_modelArrayWithClass:[KXVerticleModel class] json:json[@"data"]]; notice(array); } failure:^(NSError *error) { }]; } @end