线上所有马甲包模板,与《猎豆》同UI。域名zhuadd

HSQGoodDetailRequestViewModel.m 3.1KB

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