123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // 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
|