Nessuna descrizione

LFWFindRequestViewModel.m 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // LFWFindRequestViewModel.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/22.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWFindRequestViewModel.h"
  9. @implementation LFWFindRequestViewModel
  10. + (void)requestGuessYouLikeParamPage:(NSInteger)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  11. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/guessYouLike", BaseURL];
  12. [LFWHttp post:urlString params:@{@"page":@(page)} success:^(id json) {
  13. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]];
  14. success(arr);
  15. } failure:^(NSError *error) {
  16. failure(error);
  17. }];
  18. }
  19. + (void)requestHotSearchSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  20. NSString *urlString = [NSString stringWithFormat:@"%@/api/groupgoods/hotsearch", BaseURL];
  21. [LFWHttp get:urlString params:nil success:^(id json) {
  22. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWFindHotSearchModel class] json:json[@"data"]];
  23. success(arr);
  24. } failure:^(NSError *error) {
  25. failure(error);
  26. }];
  27. }
  28. + (void)requestChannelSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  29. NSString *urlString = [NSString stringWithFormat:@"%@/api/channel/list", BaseURL];
  30. [LFWHttp get:urlString params:nil success:^(id json) {
  31. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWFindChannelModel class] json:json[@"data"]];
  32. success(arr);
  33. } failure:^(NSError *error) {
  34. failure(error);
  35. }];
  36. }
  37. + (void)requestEveryoneSearchSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  38. NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/everyoneSearch", BaseURL];
  39. [LFWHttp get:urlString params:nil success:^(id json) {
  40. success(json);
  41. } failure:^(NSError *error) {
  42. failure(error);
  43. }];
  44. }
  45. + (void)requestVoucherFindParamPage:(NSInteger)page name:(NSString *)name success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  46. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/voucherFind", BaseURL];
  47. [LFWHttp get:urlString params:@{@"page":@(page),@"name":name} success:^(id json) {
  48. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]];
  49. success(arr);
  50. } failure:^(NSError *error) {
  51. failure(error);
  52. }];
  53. }
  54. + (void)requestCouponTotalSuccess:(void (^)(NSNumber *))success failure:(void (^)(NSError *))failure {
  55. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/couponTotal", BaseURL];
  56. [LFWHttp post:urlString params:nil success:^(id json) {
  57. success(json[@"data"][@"num"]);
  58. } failure:^(NSError *error) {
  59. failure(error);
  60. }];
  61. }
  62. + (void)requestGuideBookSuccess:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
  63. NSString *urlString = [NSString stringWithFormat:@"%@/api/homeact/guideBook", BaseURL];
  64. [LFWHttp get:urlString params:nil success:^(id json) {
  65. success(json[@"url"]);
  66. } failure:^(NSError *error) {
  67. failure(error);
  68. }];
  69. }
  70. @end