12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // YZMAGoodDetailRequestViewModel.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/24.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMAGoodDetailRequestViewModel.h"
- @implementation YZMAGoodDetailRequestViewModel
- + (void)requestGoodDetailParamGoods_id:(DetailRequestModel *)requestModel success:(void (^)(YZMAGoodDetailModel *model,NSDictionary *dic))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/goods/detail", BaseURL];
- NSDictionary *para = [requestModel modelToDictionary];
- [YZMAHttp post:urlString params:para success:^(id json) {
- YZMAGoodDetailModel *model = [YZMAGoodDetailModel yy_modelWithJSON:json[@"data"]];
- NSDictionary *dic = json[@"data"];
- success(model,dic);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestGoodSimilarParamGoods_id:(NSString *)goods_id page:(NSNumber *)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/goods/recommendlist", BaseURL];
- [YZMAHttp post:urlString params:@{@"goods_id":goods_id,@"page":page} success:^(id json) {
- NSArray *arr = [NSArray yy_modelArrayWithClass:[YZMAChildGoodModel class] json:json[@"data"]];
- 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];
- [YZMAHttp post:urlString params:@{@"sellerId":sellerId,@"page":@(page)} success:^(id json) {
- NSArray *arr = [NSArray yy_modelArrayWithClass:[YZMAChildGoodModel class] json:json[@"data"]];
- success(arr);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- + (void)requestCollectGoodParamGoods_id:(NSDictionary *)para success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/goods/addFavorites", BaseURL];
- [YZMAHttp post:urlString params:para 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];
- [YZMAHttp post:urlString params:@{@"goods_id":goods_id,@"coupon_price":coupon_price} success:^(id json) {
- success(json[@"msg"]);
- } failure:^(NSError *error) {
- failure(error);
- }];
- }
- @end
|