Няма описание

LFWGoodDetailRequestViewModel.m 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // LFWGoodDetailRequestViewModel.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/24.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWGoodDetailRequestViewModel.h"
  9. @implementation LFWGoodDetailRequestViewModel
  10. + (void)requestGoodDetailParamGoods_id:(NSString *)goods_id success:(void (^)(LFWGoodDetailModel *model,NSDictionary *dic))success failure:(void (^)(NSError *))failure {
  11. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/goodDetail", BaseURL];
  12. [LFWHttp post:urlString params:@{@"goods_id":goods_id} success:^(id json) {
  13. LFWGoodDetailModel *model = [LFWGoodDetailModel yy_modelWithJSON:json[@"data"]];
  14. NSDictionary *dic = json[@"data"];
  15. success(model,dic);
  16. } failure:^(NSError *error) {
  17. failure(error);
  18. }];
  19. }
  20. + (void)requestGoodSimilarParamGoods_id:(NSString *)goods_id success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  21. NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/manyGoods", BaseURL];
  22. [LFWHttp post:urlString params:@{@"goods_id":goods_id} success:^(id json) {
  23. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json];
  24. success(arr);
  25. } failure:^(NSError *error) {
  26. failure(error);
  27. }];
  28. }
  29. + (void)requestShopGoodParamSellerId:(NSString *)sellerId Page:(NSInteger)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
  30. NSString *urlString = [NSString stringWithFormat:@"%@/api/category/shopItems", BaseURL];
  31. [LFWHttp post:urlString params:@{@"sellerId":sellerId,@"page":@(page)} success:^(id json) {
  32. NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]];
  33. success(arr);
  34. } failure:^(NSError *error) {
  35. failure(error);
  36. }];
  37. }
  38. + (void)requestCollectGoodParamGoods_id:(NSString *)goods_id is_collect:(NSNumber *)is_collect success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
  39. NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/collectGood", BaseURL];
  40. [LFWHttp post:urlString params:@{@"goods_id":goods_id,@"is_collect":is_collect} success:^(id json) {
  41. success(json[@"msg"]);
  42. } failure:^(NSError *error) {
  43. failure(error);
  44. }];
  45. }
  46. + (void)requestTicketProcessParamGoods_id:(NSString *)goods_id coupon_price:(NSString *)coupon_price success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
  47. NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/ticketProcess", BaseURL];
  48. [LFWHttp post:urlString params:@{@"goods_id":goods_id,@"coupon_price":coupon_price} success:^(id json) {
  49. success(json[@"msg"]);
  50. } failure:^(NSError *error) {
  51. failure(error);
  52. }];
  53. }
  54. @end