// // KBFindRequestViewModel.m // YouHuiProject // // Created by xiaoxi on 2018/1/22. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBFindRequestViewModel.h" @implementation KBFindRequestViewModel + (void)requestGuessYouLikeParamPage:(NSInteger)page success:(void (^)(NSArray *))success failure:(void (^)(NSError *))failure { NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/goods/guessYouLike", BaseURL]; [KBHttp post:urlString params:@{@"page":@(page)} success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[KBChildGoodModel 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]; [KBHttp get:urlString params:nil success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[KBFindHotSearchModel 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]; [KBHttp get:urlString params:nil success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[KBFindChannelModel 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/v2/goods/everyoneSearch", BaseURL]; [KBHttp 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]; [KBHttp get:urlString params:@{@"page":@(page),@"name":name} success:^(id json) { NSArray *arr = [NSArray yy_modelArrayWithClass:[KBChildGoodModel 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]; [KBHttp 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/v2/homeact/guideBook", BaseURL]; [KBHttp get:urlString params:nil success:^(id json) { success(json[@"url"]); } failure:^(NSError *error) { failure(error); }]; } @end