Нет описания

KXMainPageViewModel.m 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // KXMainPageViewModel.m
  3. // CAISHEN
  4. //
  5. // Created by kuxuan on 2017/8/25.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXMainPageViewModel.h"
  9. #import "KXLoanAllModel.h"
  10. #import "KXRecommnedModel.h"
  11. #import "KXVerticleModel.h"
  12. @implementation KXMainPageViewModel
  13. + (void)loanAllLabelName:(void (^)(id json))success
  14. {
  15. NSString *urlString=[NSString stringWithFormat:@"%@/category/list",URL];
  16. [KXHTTP post:urlString params:nil success:^(id json) {
  17. NSArray *array=[NSArray yy_modelArrayWithClass:[KXLoanAllModel class] json:json];
  18. success(array);
  19. } failure:^(NSError *error) {
  20. }];
  21. }
  22. + (void)getAdAlertUrl:(void (^)(KXLaunchModel *model))launch
  23. {
  24. NSString *urlString = [NSString stringWithFormat:@"%@/advert/getAlertAdvertRand",URL];
  25. [KXHTTP post:urlString params:nil success:^(id json) {
  26. KXLaunchModel *model = [KXLaunchModel yy_modelWithJSON:json[@"data"]];
  27. launch(model);
  28. } failure:^(NSError *error) {
  29. }];
  30. }
  31. + (void)recommendData:(NSDictionary *)para data:(void(^)(NSArray *dataSource))data
  32. {
  33. NSString *urlString = [NSString stringWithFormat:@"%@/product/getSameAmountByProductId",URL];
  34. [KXHTTP post:urlString params:para success:^(id json) {
  35. NSArray *array = [NSArray yy_modelArrayWithClass:[KXRecommnedModel class] json:json[@"data"]];
  36. data(array);
  37. } failure:^(NSError *error) {
  38. }];
  39. }
  40. + (void)requestVerticleViewData:(void (^)(NSArray *notice))notice
  41. {
  42. NSString *urlString = [NSString stringWithFormat:@"%@/homeact/getNoticeList",URL];
  43. [KXHTTP post:urlString params:nil success:^(id json) {
  44. NSArray *array = [NSArray yy_modelArrayWithClass:[KXVerticleModel class] json:json[@"data"]];
  45. notice(array);
  46. } failure:^(NSError *error) {
  47. }];
  48. }
  49. +(void)requestVerticleHuaJiangHu:(void (^)(NSArray *))notice {
  50. // https://newapi.henhaojie.com/user/homeact/getNoticeList
  51. NSString *urlString = [NSString stringWithFormat:@"%@/homeact/getNoticeList",URL];
  52. [KXHTTP post:urlString params:nil success:^(id json) {
  53. NSArray *array = [NSArray yy_modelArrayWithClass:[KXVerticleModel class] json:json[@"data"]];
  54. notice(array);
  55. } failure:^(NSError *error) {
  56. }];
  57. }
  58. @end