天天省钱快报

KBNineNineRequestViewModel.m 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // KBNineNineRequestViewModel.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/22.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBNineNineRequestViewModel.h"
  9. @implementation KBNineNineRequestViewModel
  10. + (void)requestNineNineGoodListParamGid:(NSInteger)gid success:(void (^)(KBNineNineModel *))success failure:(void (^)(NSError *))failure {
  11. NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/getGoodlistByGid", BaseURL];
  12. [KBHttp post:urlString params:@{@"tab":@"NO_POSTAGE"} success:^(id json) {
  13. KBNineNineModel *model = [KBNineNineModel yy_modelWithJSON:json[@"data"]];
  14. success(model);
  15. } failure:^(NSError *error) {
  16. failure(error);
  17. }];
  18. }
  19. + (void)requestNineNineSublistParamType:(NSString *)type success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  20. NSString *urlString = [NSString stringWithFormat:@"%@/api/channel/sublist", BaseURL];
  21. [KBHttp get:urlString params:@{@"type":type} success:^(id json) {
  22. NSArray *arr = [NSArray yy_modelArrayWithClass:[KBNineNineScrollChannelModel class] json:json[@"data"]];
  23. success(arr);
  24. } failure:^(NSError *error) {
  25. failure(error);
  26. }];
  27. }
  28. + (void)requestNineNineCategoryGoodsParamPage:(NSInteger)page scid:(NSNumber *)scid type:(NSString *)type stype:(NSString *)stype success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  29. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/categoryGoods", BaseURL];
  30. [KBHttp post:urlString params:@{@"page":@(page),@"scid":scid,@"type":type,@"stype":stype} success:^(id json) {
  31. NSArray *arr = [NSArray yy_modelArrayWithClass:[KBChildGoodModel class] json:json[@"data"]];
  32. success(arr);
  33. } failure:^(NSError *error) {
  34. failure(error);
  35. }];
  36. }
  37. @end