Commit cc1a1c40 authored by Sandy's avatar Sandy

query都加上了域 domain

parent 6b482276
......@@ -92,6 +92,7 @@
1979754A1CAA4DB900407E3F /* CommodityMutipleSelectBottomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 197975491CAA4DB900407E3F /* CommodityMutipleSelectBottomView.xib */; };
1979754D1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1979754C1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m */; };
197975511CAB6F5D00407E3F /* OrderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 197975501CAB6F5D00407E3F /* OrderViewController.m */; };
1983EF451CBE2726004510B3 /* ManagementSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */; };
199B4D681CABBCF600451E0E /* OrderDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 199B4D671CABBCF600451E0E /* OrderDetailViewController.m */; };
199B4D6A1CABBEF400451E0E /* OrderDetailTopView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 199B4D691CABBEF400451E0E /* OrderDetailTopView.xib */; };
199B4D6D1CABBF0800451E0E /* OrderDetailTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 199B4D6C1CABBF0800451E0E /* OrderDetailTopView.m */; };
......@@ -382,6 +383,8 @@
1979754C1CAB6E1300407E3F /* JavenMultipleViewWithHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenMultipleViewWithHeader.m; sourceTree = "<group>"; };
1979754F1CAB6F5D00407E3F /* OrderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderViewController.h; sourceTree = "<group>"; };
197975501CAB6F5D00407E3F /* OrderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderViewController.m; sourceTree = "<group>"; };
1983EF431CBE2726004510B3 /* ManagementSearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagementSearchViewController.h; sourceTree = "<group>"; };
1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManagementSearchViewController.m; sourceTree = "<group>"; };
199B4D661CABBCF600451E0E /* OrderDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderDetailViewController.h; sourceTree = "<group>"; };
199B4D671CABBCF600451E0E /* OrderDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OrderDetailViewController.m; sourceTree = "<group>"; };
199B4D691CABBEF400451E0E /* OrderDetailTopView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OrderDetailTopView.xib; sourceTree = "<group>"; };
......@@ -911,6 +914,8 @@
1979752D1CA90D6C00407E3F /* CommodityManagementViewController.m */,
197975431CAA2FAB00407E3F /* ManagementViewController.h */,
197975441CAA2FAB00407E3F /* ManagementViewController.m */,
1983EF431CBE2726004510B3 /* ManagementSearchViewController.h */,
1983EF441CBE2726004510B3 /* ManagementSearchViewController.m */,
);
name = CommodityManagement;
sourceTree = "<group>";
......@@ -1905,6 +1910,7 @@
1946DC9A1CB7542D00AC6557 /* CatgoryModel.m in Sources */,
197975511CAB6F5D00407E3F /* OrderViewController.m in Sources */,
19DCCBDF1C9AA0450072C3BF /* ICRPlaceholderTextView.m in Sources */,
1983EF451CBE2726004510B3 /* ManagementSearchViewController.m in Sources */,
1900A33C1CB602D500B2B7C4 /* StoreNameViewController.m in Sources */,
19DCCBCD1C9AA0450072C3BF /* UIFont+Custom.m in Sources */,
19DCCBE41C9AA0450072C3BF /* ICRFunctionEntity.m in Sources */,
......
......@@ -51,7 +51,7 @@
[[HTTPCilent shareCilent] POST:@"shop/addGoods" parameters:param success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber: @0]) {
[weakSelf addSUccess];
weakSelf.successBlock();
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
......
......@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface CommodityManagementTopView : UIView
@property (nonatomic, strong) NSMutableArray *arrDatas;
@end
......@@ -29,6 +29,7 @@
ManagementViewController *manageVC = [[ManagementViewController alloc] init];
[self hideSortView];
manageVC.isShowNavigationBar = YES;
manageVC.arrCellData = [self.arrDatas mutableCopy];
[[self viewController] PushViewController:manageVC animated:YES];
CLog(@"m");
......
......@@ -37,6 +37,9 @@
//配置navigationbar
self.navigationItem.title = @"商品列表";
self.view.backgroundColor = kBacroundColor;
self.field = @"";
self.direction = @"desc";
[self setUpSortView];
[self setUpCollectionView];
[self setUpData];
......@@ -53,38 +56,43 @@
- (void)setUpData {
//前期发送请求生成参数的方式,后来不这么做了
NSString *jsonString = @"{\"defintion\":{\"conditions\":[{\"operation\":\"string\",\"parameter\":{},\"parameters\":[{}]}],\"orders\":[{\"field\":\"string\",\"direction\":\"asc\"}],\"pageSize\":0,\"page\":0,\"probePages\":0},\"fetchParts\":[\"string\"]}";
NSDictionary *dic = [jsonString mj_JSONObject];
CommotityRequestModel *requstBody = [CommotityRequestModel modelObjectWithDictionary:dic];
requstBody.defintion.pageSize = kPageSize;
requstBody.defintion.page = @0;
requstBody.defintion.probePages = @0;
requstBody.defintion.orders[0].field = self.field;
requstBody.defintion.orders[0].direction = self.direction;
NSString *parameters;
NSString *operation;
if ([self.model isKindOfClass:[HotBrandModel class]]) {//热门品牌
//设置请求模型
HotBrandModel *model = self.model;
requstBody.defintion.conditions[0].operation = @"goodsData brand uuid equals";
requstBody.defintion.conditions[0].parameters = @[model.uuid];
operation = @"goodsData brand uuid equals";
parameters = model.uuid;
}else if([self.model isKindOfClass:[CatgoryModel class]]){//分类
CatgoryModel *model = self.model;
requstBody.defintion.conditions[0].operation = @"goodsData category uuid equals";
requstBody.defintion.conditions[0].parameters = @[model.uuid];
operation = @"goodsData category uuid equals";
parameters = model.uuid;
}else if ([self.model isKindOfClass:[JavenHotTagsModel class]]){//热门标签
CatgoryModel *model = self.model;
requstBody.defintion.conditions[0].operation = @"goodsData category uuid equals";
requstBody.defintion.conditions[0].parameters = @[model.uuid];
operation = @"goodsData category uuid equals";
parameters = model.uuid;
}
//请求模型转化为字典
NSDictionary *params = requstBody.mj_keyValues;
NSDictionary *myDictionary = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].domain]},
@{@"operation" : operation,
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[parameters]}],
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"pageSize" : kPageSize,
@"page" : @0,
@"probePages" : @0},
@"fetchParts" : @[@"string"]};
NSString *string = [myDictionary mj_JSONString];
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:myDictionary success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
......@@ -133,8 +141,8 @@
switch (row) {
case 0:
{
self.field = nil;
self.direction = nil;
self.field = @"";
self.direction = @"desc";
}
break;
case 1://价格 高-低
......@@ -221,7 +229,9 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellID forIndexPath:indexPath];
cell.successBlock = ^{
};
[cell cellWithModel:self.arrItemDatas[indexPath.row]];
return cell;
}
......
......@@ -33,7 +33,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.direction = @"desc";
self.field = @"";
[self setUpSearchBar];
[self setUpSortView];
[self setUpCollectionView];
......@@ -73,24 +74,22 @@
- (void)setUpData {
//前期发送请求生成参数的方式,后来不这么做了
NSString *jsonString = @"{\"defintion\":{\"conditions\":[{\"operation\":\"string\",\"parameter\":{},\"parameters\":[{}]}],\"orders\":[{\"field\":\"string\",\"direction\":\"asc\"}],\"pageSize\":0,\"page\":0,\"probePages\":0},\"fetchParts\":[\"string\"]}";
NSDictionary *dic = [jsonString mj_JSONObject];
CommotityRequestModel *requstBody = [CommotityRequestModel modelObjectWithDictionary:dic];
requstBody.defintion.conditions[0].operation = @"goodsData name like";
requstBody.defintion.conditions[0].parameters = @[self.searchText];
requstBody.defintion.pageSize = kPageSize;
requstBody.defintion.page = @0;
requstBody.defintion.probePages = @0;
requstBody.defintion.orders[0].field = self.field;
requstBody.defintion.orders[0].direction = self.direction;
NSDictionary *myDictionary = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"goodsData name like",
@"parameters" : @[self.searchText]},
@{@"operation" : @"domain equals",
@"parameters" : @[[UserInfo shareInstance].domain]},
],
@"orders" : @[@{@"direction" : self.direction,
@"field" : self.field}],
@"page" : @0,
@"pageSize" : @999,
@"probePages" : @0},
@"fetchParts" : [NSNull null]};
//请求模型转化为字典
NSDictionary *params = requstBody.mj_keyValues;
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
[[HTTPCilent shareCilent] POST:@"goods/query2" parameters:myDictionary success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
......@@ -231,7 +230,7 @@
CLog(@"点击搜索");
[self.navigationController.navigationBar endEditing:YES];
[self setUpData];
[self resetReloadData];
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
......
//
// ManagementSearchViewController.h
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface ManagementSearchViewController : IBTUIViewController
@end
//
// ManagementSearchViewController.m
// ALand
//
// Created by Z on 16/4/13.
// Copyright © 2016年 Z. All rights reserved.
//
#import "ManagementSearchViewController.h"
@interface ManagementSearchViewController ()<UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
@end
@implementation ManagementSearchViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpSearchBar];
// Do any additional setup after loading the view.
}
- (void)setUpSearchBar {
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 35)];//allocate titleView
UIColor *color = self.navigationController.navigationBar.barTintColor;
[titleView setBackgroundColor:color];
UISearchBar *searchBar = [[UISearchBar alloc] init];
searchBar.delegate = self;
searchBar.frame = CGRectMake(0, 0, 260, 35);
searchBar.centerX = titleView.centerX;
searchBar.backgroundImage = [UIImage imageWithColor:color];
[searchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[titleView addSubview:searchBar];
self.navigationItem.titleView = titleView;
[searchBar becomeFirstResponder];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -8,7 +8,8 @@
#import "IBTUIViewController.h"
#import "CommodityManagementSortView.h"
#import "CommodityManagementViewController.h"
@interface ManagementViewController : IBTUIViewController
@property (nonatomic, strong) CommodityManagementSortView *sorView;
@property (nonatomic, strong) NSMutableArray *arrCellData;
@end
......@@ -87,12 +87,12 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
return self.arrCellData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CommodityTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
[cell cellWithModel:self.arrCellData[indexPath.row]];
return cell;
}
......
......@@ -43,29 +43,29 @@
//本地已有密码时登录
- (void)defaultLoginAction {
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]) {
NSDictionary *paramers = @{@"domain":kDomain,
@"loginName":[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"] ,
@"password":[[NSUserDefaults standardUserDefaults] objectForKey:@"passWord"],
@"rememberMe":@"true"};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
UserInfo *info = [UserInfo shareInstance];
[info UserInfoWithDictionary:responseObject[@"reseller"]];
[MBProgressHUD hideHUDForView:self.view animated:YES];
BaseViewController *baseVC = [[BaseViewController alloc] init];
baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[weakSelf presentViewController:baseVC animated:YES completion:nil];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
// if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]) {
//
// NSDictionary *paramers = @{@"domain":kDomain,
// @"loginName":[[NSUserDefaults standardUserDefaults] objectForKey:@"userName"] ,
// @"password":[[NSUserDefaults standardUserDefaults] objectForKey:@"passWord"],
// @"rememberMe":@"true"};
// [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// WS(weakSelf)
// [[HTTPCilent shareCilent] POST:@"app/resellerLogin" parameters:paramers success:^(NSURLSessionDataTask *task, id responseObject) {
// UserInfo *info = [UserInfo shareInstance];
// [info UserInfoWithDictionary:responseObject[@"reseller"]];
//
//
// [MBProgressHUD hideHUDForView:self.view animated:YES];
// BaseViewController *baseVC = [[BaseViewController alloc] init];
// baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// [weakSelf presentViewController:baseVC animated:YES completion:nil];
// } failure:^(NSURLSessionDataTask *task, NSError *error) {
//
// }];
//
//
// }
}
......
......@@ -49,6 +49,7 @@
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
CLog(@"POST请求失败!----->%@", [error localizedDescription]);
failure(task, error);
}];
}
......
......@@ -12,8 +12,8 @@
@interface Defintion : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSNumber *pageSize;
@property (nonatomic, strong) NSArray<Orders *> *orders;
@property (nonatomic, strong) NSArray<Conditions *> *conditions;
@property (nonatomic, strong) NSMutableArray<Orders *> *orders;
@property (nonatomic, strong) NSMutableArray<Conditions *> *conditions;
@property (nonatomic, assign) NSNumber *probePages;
@property (nonatomic, strong) NSNumber *page;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment