123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // LFWGoodDetailRequestViewModel.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/24.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LFWGoodDetailRequestViewModel.h"
- @implementation LFWGoodDetailRequestViewModel
- + (void)requestGoodDetailParamGoods_id:(NSString *)goods_id success:(void (^)(LFWGoodDetailModel *model,NSDictionary *dic))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/category/goodDetail", BaseURL];
- [LFWHttp post:urlString params:@{@"goods_id":goods_id} success:^(id json) {
- LFWGoodDetailModel *model = [LFWGoodDetailModel yy_modelWithJSON:json[@"data"]];
- NSDictionary *dic = json[@"data"];
- success(model,dic);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestGoodSimilarParamGoods_id:(NSString *)goods_id success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/manyGoods", BaseURL];
- [LFWHttp post:urlString params:@{@"goods_id":goods_id} success:^(id json) {
- NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json];
- success(arr);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestShopGoodParamSellerId:(NSString *)sellerId Page:(NSInteger)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/category/shopItems", BaseURL];
- [LFWHttp post:urlString params:@{@"sellerId":sellerId,@"page":@(page)} success:^(id json) {
- NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]];
- success(arr);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestCollectGoodParamGoods_id:(NSString *)goods_id is_collect:(NSNumber *)is_collect success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/collectGood", BaseURL];
- [LFWHttp post:urlString params:@{@"goods_id":goods_id,@"is_collect":is_collect} success:^(id json) {
- success(json[@"msg"]);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestTicketProcessParamGoods_id:(NSString *)goods_id coupon_price:(NSString *)coupon_price success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/ticketProcess", BaseURL];
- [LFWHttp post:urlString params:@{@"goods_id":goods_id,@"coupon_price":coupon_price} success:^(id json) {
- success(json[@"msg"]);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- @end
|