// // LFWFindRequestViewModel.m // YouHuiProject // // Created by xiaoxi on 2018/1/22. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LFWFindRequestViewModel.h" @implementation LFWFindRequestViewModel + (void)requestGuessYouLikeParamPage:(NSInteger)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/category/guessYouLike", BaseURL]; [LFWHttp post:urlString params:@{@"page":@(page)} success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]]; success(arr); } failure:^(NSError *error) { failure(error); }]; } + (void)requestHotSearchSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/groupgoods/hotsearch", BaseURL]; [LFWHttp get:urlString params:nil success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWFindHotSearchModel class] json:json[@"data"]]; success(arr); } failure:^(NSError *error) { failure(error); }]; } + (void)requestChannelSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/channel/list", BaseURL]; [LFWHttp get:urlString params:nil success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWFindChannelModel class] json:json[@"data"]]; success(arr); } failure:^(NSError *error) { failure(error); }]; } + (void)requestEveryoneSearchSuccess:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/goods/everyoneSearch", BaseURL]; [LFWHttp get:urlString params:nil success:^(id json) { success(json); } failure:^(NSError *error) { failure(error); }]; } + (void)requestVoucherFindParamPage:(NSInteger)page name:(NSString *)name success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/category/voucherFind", BaseURL]; [LFWHttp get:urlString params:@{@"page":@(page),@"name":name} success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json[@"data"]]; success(arr); } failure:^(NSError *error) { failure(error); }]; } + (void)requestCouponTotalSuccess:(void (^)(NSNumber *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/category/couponTotal", BaseURL]; [LFWHttp post:urlString params:nil success:^(id json) { success(json[@"data"][@"num"]); } failure:^(NSError *error) { failure(error); }]; } + (void)requestGuideBookSuccess:(void (^)(NSString *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/homeact/guideBook", BaseURL]; [LFWHttp get:urlString params:nil success:^(id json) { success(json[@"url"]); } failure:^(NSError *error) { failure(error); }]; } @end