Commit 9c34422c by liuZX

修复自助服务bug 提交新的充值接口

parent 03a219ed
......@@ -369,6 +369,7 @@
A770521B211D231D00798513 /* ZXDrinkService.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521A211D231D00798513 /* ZXDrinkService.m */; };
A770521E211D2F9E00798513 /* ZXDrinkAdModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521D211D2F9E00798513 /* ZXDrinkAdModel.m */; };
A7705221211D3A2B00798513 /* ZXDrinkMerthinModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A7705220211D3A2B00798513 /* ZXDrinkMerthinModel.m */; };
A77097E52237A7A4002D9D97 /* ZX_recharge_item.m in Sources */ = {isa = PBXBuildFile; fileRef = A77097E42237A7A4002D9D97 /* ZX_recharge_item.m */; };
A77315612123C35A00E57D6E /* ZXGoPutFreeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A77315602123C35A00E57D6E /* ZXGoPutFreeCell.m */; };
A77DE2CA20DB4ACD002FB903 /* washingsss.gif in Resources */ = {isa = PBXBuildFile; fileRef = A77DE2C920DB4ACC002FB903 /* washingsss.gif */; };
A77DE2CD20DB6F55002FB903 /* ZXLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A77DE2CC20DB6F55002FB903 /* ZXLocationViewController.m */; };
......@@ -1330,6 +1331,8 @@
A770521D211D2F9E00798513 /* ZXDrinkAdModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXDrinkAdModel.m; sourceTree = "<group>"; };
A770521F211D3A2B00798513 /* ZXDrinkMerthinModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXDrinkMerthinModel.h; sourceTree = "<group>"; };
A7705220211D3A2B00798513 /* ZXDrinkMerthinModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXDrinkMerthinModel.m; sourceTree = "<group>"; };
A77097E32237A7A4002D9D97 /* ZX_recharge_item.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZX_recharge_item.h; sourceTree = "<group>"; };
A77097E42237A7A4002D9D97 /* ZX_recharge_item.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZX_recharge_item.m; sourceTree = "<group>"; };
A773155F2123C35A00E57D6E /* ZXGoPutFreeCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXGoPutFreeCell.h; sourceTree = "<group>"; };
A77315602123C35A00E57D6E /* ZXGoPutFreeCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXGoPutFreeCell.m; sourceTree = "<group>"; };
A77B6477070B2B544C13AE6C /* Pods-ColorfulSchool.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ColorfulSchool.release.xcconfig"; path = "Pods/Target Support Files/Pods-ColorfulSchool/Pods-ColorfulSchool.release.xcconfig"; sourceTree = "<group>"; };
......@@ -2287,6 +2290,8 @@
A7C305F321EEF5C0004F06C3 /* ZXSXModel.m */,
A7DA71CA214BB38000A21658 /* ZXPayTypeModel.h */,
A7DA71CB214BB38000A21658 /* ZXPayTypeModel.m */,
A77097E32237A7A4002D9D97 /* ZX_recharge_item.h */,
A77097E42237A7A4002D9D97 /* ZX_recharge_item.m */,
);
path = Modle;
sourceTree = "<group>";
......@@ -5109,6 +5114,7 @@
A705C02021D4B067004F1628 /* MWZoomingScrollView.m in Sources */,
A756C5AF21F9B5960006E418 /* ZXNewPayOrderListViewController.m in Sources */,
A75436E121D34567005584CC /* FetchCheckCodeModel.m in Sources */,
A77097E52237A7A4002D9D97 /* ZX_recharge_item.m in Sources */,
A7F3E1C321B5350600010E23 /* unzip.c in Sources */,
22704B071F481B0A00B8D786 /* ChangePassWordModel.m in Sources */,
A7265BF420CA45690084B814 /* GYRollingNoticeView.m in Sources */,
......
......@@ -13,5 +13,21 @@
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/NewFirstPage(&#x65b0;&#x7248;&#x9996;&#x9875;)/ViewModel/ZXFirstPageService.m"
timestampString = "574228712.707621"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "50"
endingLineNumber = "50"
landmarkName = "-loadFirstPageDataCompleted:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -88,7 +88,7 @@
// [userDefaults setObject:@"http://192.168.1.102:8000" forKey:@"NEW_PAY"];
// [userDefaults setObject:@"http://192.168.1.102:9090" forKey:@"SX_MONEY"];
[userDefaults setObject:@"http://ex-dev-dcxy-base-app.168cad.top" forKey:@"SX_MONEY"]; //授信保证金
[userDefaults setValue:@"http://121.15.180.66:801/netpayment/BaseHttp.dll?MB_EUserPay" forKey:@"YWT_PAY"];
[userDefaults synchronize];
......
......@@ -57,7 +57,7 @@
_isPlaying = NO;
[self defaultConfig];
//启动环境
[self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentTest];
[self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentProduct];
//极光推送
[self initPushWithOptions:launchOptions isProduct:kJPushIsProduct];
//网络监测
......@@ -84,7 +84,7 @@
if (CacheToken&&![CacheToken isEqualToString:@""])//如果登录了
{
[ZXTool loginSuccessJump:^(NSString *jump) {
jump = @"DC_02";
if ([jump isEqualToString:@"NONE"]) {
//先读取缓存
NSArray *list = [LoginJump findAll];
......@@ -150,6 +150,8 @@
[info update];
}
});
//创建开屏广告
[[ZXTXAdTool sharedZXTXAdTool] createLauchAdByPlacmentId:@"9090758636743260"];
[kUserDefaults setObject:[ZXTool getCurrentTimeStamp] forKey:@"uploadBatch"];
if ([[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")]) {
[kUserDefaults setObject:@([UIScreen mainScreen].brightness) forKey:@"defaultBright"];
......
//
//
......@@ -21,62 +21,15 @@
@end
@implementation LoginView
- (void)dealloc{
[self removeNotificationAndKVO];
}
-(void)registNotificationAndKVO{
[self.loginModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.loginModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
[self.loginModel removeObserver:self forKeyPath:@"isLoaded"];
[self.loginModel removeObserver:self forKeyPath:@"error"];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.loginModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[ZXTool loginSuccessJump:^(NSString *jump) {
[SVProgressHUD dismiss];
if ([jump isEqualToString:@"NONE"]) {
//先读取缓存
NSArray *list = [LoginJump findAll];
if (list.count == 0) {
jump = @"DC_01";
} else {
LoginJump *m = list.lastObject;
jump = m.modelCode;
}
}
if ([jump isEqualToString:@"DC_02"]) {
//跳转简单版
ZXSimpleRootTabbarController *simpleRoot = [[ZXSimpleRootTabbarController alloc] init];
[UIApplication sharedApplication].keyWindow.rootViewController = simpleRoot;
} else {
//跳转复杂版
MyTabViewController * tabRoot = [[MyTabViewController alloc]init];
[UIApplication sharedApplication].keyWindow.rootViewController = tabRoot;
}
}];
}
else{
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setViews];
self.loginModel=[LoginModel new];
[self registNotificationAndKVO];
self.userTF.text = CacheAccount;
// self.passWorldTF.text = CachePassWord;
self.userTF.delegate=self;
......@@ -155,8 +108,6 @@
return;
}
[[UIApplication sharedApplication].keyWindow endEditing:YES];
// [self.loginModel loginWithPhoneNum:self.userTF.text password:self.passWorldTF.text];
[SVProgressHUD showWithStatus:@" 正在登录 ,请稍后 "];
[self startLoginByAccount:self.userTF.text password:self.passWorldTF.text];
}
......@@ -240,21 +191,14 @@
// [userDefaults setObject:self.item.schoolName forKey:@"schoolName"];
[userDefaults setObject:user.studentNo forKey:@"studentNo"];
[userDefaults setObject:user.customerName forKey:@"username"];
[userDefaults setObject:@(!user.hardwareState) forKey:@"devPassSwitch"];
[userDefaults setObject:@(user.isUploadLog) forKey:@"isUploadLog"];
[userDefaults setObject:[NSString stringWithFormat:@"%ld", !user.hardwareState] forKey:@"devPassSwitch"];
[userDefaults setObject:[NSString stringWithFormat:@"%ld", !user.isUploadLog] forKey:@"isUploadLog"];
[userDefaults synchronize];
NSLog(@"====%@",CacheUserId);
}
- (IBAction)registerBtnFuc:(id)sender {
// [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
// [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.005 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// RegisterViewController * VC=[RegisterViewController new];
// self.navigationController.navigationBar.hidden = NO;
// [self.navigationController pushViewController:VC animated:YES];
// });
UIViewController *vc = [[NSClassFromString(@"ZXRegistorViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES];
......
//
//
......@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface AimiWalletViewController : UIViewController
@property (nonatomic) NSString * comeFrom;
@property (nonatomic) NSString *comeFrom;
@end
//
//
......@@ -19,7 +19,7 @@
#import "ZXPayTypeModel.h"
#import "ZXConfirmPayViewController.h"
#import "ZXSXModel.h"
#import "ZX_recharge_item.h"
static NSString * const TopUpWalletID = @"TopUpCell";
static NSString * const PayTypeCellID = @"PayTypeCell";
static NSString * const ID = @"CollectionCell";
......@@ -44,6 +44,10 @@ static NSString * const ID = @"CollectionCell";
//beanView数据
@property (strong, nonatomic) NSMutableArray * beanArray;
//充值项集合
@property (strong, nonatomic) NSMutableArray * rechargeList;
@property (nonatomic)FetchAccoutDataModel * accountDataModel;
@property (nonatomic)FetchWalletTopUpDataModel * topUpDataModel;
@property (nonatomic)PayModel * payModel;
......@@ -51,18 +55,13 @@ static NSString * const ID = @"CollectionCell";
/**
正常充
*/
@property (nonatomic)TopUpDataItem * selectTopUpItem;
@property (nonatomic)ZX_recharge_item * selectTopUpItem;
/**
首充
*/
@property (nonatomic)FirstTopUpDataItem * selectFirstTopUpItem;
@property (nonatomic)NSString * payTypeStr;
@property (nonatomic,assign)BOOL isPayTypeChangeCauseReload;
@property (nonatomic,assign)BOOL isPaySuccessCauseReload;
@property (nonatomic, assign) BOOL isOld;
//余额列表
......@@ -82,11 +81,15 @@ static NSString * const ID = @"CollectionCell";
}
return _dataArray;
}
- (NSMutableArray *)rechargeList {
if (!_rechargeList) {
_rechargeList = [[NSMutableArray alloc] init];
}
return _rechargeList;
}
-(void)registNotificationAndKVO {
[self.accountDataModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.accountDataModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
[self.topUpDataModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.topUpDataModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
[self.payModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.payModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
......@@ -96,8 +99,6 @@ static NSString * const ID = @"CollectionCell";
[self.accountDataModel removeObserver:self forKeyPath:@"isLoaded"];
[self.accountDataModel removeObserver:self forKeyPath:@"error"];
[self.topUpDataModel removeObserver:self forKeyPath:@"isLoaded"];
[self.topUpDataModel removeObserver:self forKeyPath:@"error"];
[self.payModel removeObserver:self forKeyPath:@"isLoaded"];
[self.payModel removeObserver:self forKeyPath:@"error"];
......@@ -110,71 +111,18 @@ static NSString * const ID = @"CollectionCell";
item.money = [item.peasNumber floatValue];
[self.moneyArray addObject:item];
}
//[self createFooter];
//[self loadDataWithIsShowJDPay:self.accountDataModel.accountDataModelItem.attached];
[beanCollectionView reloadData];
self.moneyLabel.text=self.accountDataModel.accountDataModelItem.aimiMoney;
self.aimiLabel.text = @"我的艾米币";
// if ([self.accountDataModel.accountDataModelItem.aimiMoney floatValue] > 0) {
// self.moneyLabel.text=self.accountDataModel.accountDataModelItem.aimiMoney;
// self.aimiLabel.text = @"我的艾米币";
// } else {
// [self.sxMoneyLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(self.view.mas_left).offset(23 * k6Scale);
// make.top.equalTo(self.backBtn.mas_bottom).offset(50 * k6Scale);
// }];
// [self.sxLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(self.view.mas_left).offset(23 * k6Scale);
// make.bottom.equalTo(self.sxMoneyLabel.mas_top).offset(-5 * k6Scale);
// }];
// }
} else { }
}
if (object == self.topUpDataModel) {
if (self.topUpDataModel.ListArray.count) {
self.selectTopUpItem=self.topUpDataModel.ListArray[0];
} else {
self.selectTopUpItem=self.topUpDataModel.FirstListArray[0];
}
if ([keyPath isEqualToString:@"isLoaded"]) {
[self.tableView reloadData];
} else { }
}
if (object == self.payModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
[SVProgressHUD dismiss];
// // [SVProgressHUD showWithStatus:@"正在准备支付,请稍后"];
// //调起支付
// if ([self.payTypeStr isEqualToString:@"wx"]) {
//
// [self payWithData:self.payModel.PayItem AliData:nil];
//
// } else if ([self.payTypeStr isEqualToString:@"ali"]){
//
// [self payWithData:nil AliData:self.payModel.aliData];
// } else if ([self.payTypeStr isEqualToString:@"jd"]){
//
// NSString *merchant = self.payModel.merchant;
// NSString *key = self.payModel.md5Key;
// NSString *orderId = self.payModel.jdOrderId;
// NSString *appId = self.payModel.appId;
// [[JDPAuthSDK sharedJDPay] registServiceWithAppID:appId merchantID:merchant];
//
// NSString *singData = [NSString stringWithFormat:@"merchant=%@&orderId=%@&key=%@", merchant, orderId, key].MD5Digest;
//
//
// @weakify(self);
// [[JDPAuthSDK sharedJDPay] payWithViewController:self orderId:orderId signData:singData completion:^(NSDictionary *resultDict) {
// @strongify(self);
// BOOL status = [resultDict[@"payStatus"] isEqualToString:@"JDP_PAY_SUCCESS"];
// confirmBtn.enabled = YES;
// if (status) {
// [self jdPaySuccess];
// }
// }];
// }
} else {
[SVProgressHUD dismiss];
confirmBtn.enabled = YES;
......@@ -185,7 +133,6 @@ static NSString * const ID = @"CollectionCell";
- (void)viewDidLoad {
[super viewDidLoad];
self.accountDataModel=[FetchAccoutDataModel new];
self.topUpDataModel=[FetchWalletTopUpDataModel new];
self.payModel=[PayModel new];
[self registNotificationAndKVO];
self.isNeedOld = YES;
......@@ -212,10 +159,6 @@ static NSString * const ID = @"CollectionCell";
}
});
}];
[self.topUpDataModel fetchTopUpeData];
self.tableView.delegate=self;
self.tableView.dataSource=self;
......@@ -226,21 +169,11 @@ static NSString * const ID = @"CollectionCell";
[self.tableView registerNib:[UINib nibWithNibName:@"PayTypeCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:PayTypeCellID];
// Do any additional setup after loading the view from its nib.
[self creatBeanCollectionView];
[ZXTool requestPayStylesCompleted:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
//[ZXTool showText:error];
} else {
JDPayItem *item = [JDPayItem mj_objectWithKeyValues:common.data];
[self createFooter];
[self loadDataWithIsShowJDPay:item];
}
});
}];
[self creatBeanCollectionView];
/*获取最新的充值祥和充值方式*/
[self zx_new_get_recharge_info];
}
- (void) getSXBZJ {
//获取授信-保证金
......@@ -404,31 +337,6 @@ static NSString * const ID = @"CollectionCell";
}
-(void)loadDataWithIsShowJDPay:(JDPayItem *) item {
[self.dataArray removeAllObjects];
if (item.supportWxPay) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"weixin";
m.topic = @"微信充值";
[self.dataArray addObject:m];
}
if (item.supportAliPay) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"zhifubao";
m.topic = @"支付宝充值";
[self.dataArray addObject:m];
}
if (item.supportJdPay) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"JD";
m.topic = @"京东充值";
[self.dataArray addObject:m];
}
ZXPayTypeModel *m = self.dataArray.firstObject;
m.isSelect = YES;
[self.tableView reloadData];
}
#pragma -mark UITableView delegate
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section {
......@@ -439,7 +347,7 @@ heightForFooterInSection:(NSInteger)section {
if (indexPath.section==0) {
return self.topUpDataModel.CellHeigh+39+10;
return [self CellHeigh]+39+10;
}
if (indexPath.section==1) {
......@@ -475,47 +383,12 @@ heightForFooterInSection:(NSInteger)section {
}
cell.selectionStyle= UITableViewCellSelectionStyleNone;
if (self.isPayTypeChangeCauseReload==YES) {
self.isPayTypeChangeCauseReload=NO;
} else {
if ([self.comeFrom isEqualToString:@"firstTopUp"]) {
[cell setUpWithArray:self.topUpDataModel.FirstListArray CollectionViewHeigh:self.topUpDataModel.CellHeigh];
//默认选择第一个
if (self.topUpDataModel.FirstListArray.count>0) {
if (self.selectFirstTopUpItem==nil) {
self.selectFirstTopUpItem=self.topUpDataModel.FirstListArray[0];
}
}
if (self.isPaySuccessCauseReload){
self.isPaySuccessCauseReload=NO;
self.selectFirstTopUpItem=self.topUpDataModel.FirstListArray[0];
}
cell.mySelectFirstTopUpItem = ^(FirstTopUpDataItem *item) {
self.selectFirstTopUpItem=item;
};
} else {
[cell setUpWithArray:self.topUpDataModel.ListArray CollectionViewHeigh:self.topUpDataModel.CellHeigh];
//默认选择第一个
if (self.topUpDataModel.ListArray.count>0) {
if (self.selectTopUpItem==nil) {
self.selectTopUpItem=self.topUpDataModel.ListArray[0];
}
}
// if (self.isPaySuccessCauseReload){
// self.isPaySuccessCauseReload=NO;
// self.selectTopUpItem=self.topUpDataModel.ListArray[0];
// }
cell.mySelectTopUpItem = ^(TopUpDataItem *item) {
self.selectTopUpItem=item;
};
}
}
[cell setUpWithArray:self.rechargeList CollectionViewHeigh:[self CellHeigh]];
@weakify(self);
cell.mySelectTopUpItem = ^(ZX_recharge_item *item) {
@strongify(self);
[self chooseRechargeItem:item];
};
return cell;
}
if (indexPath.section==1){
......@@ -551,7 +424,7 @@ heightForFooterInSection:(NSInteger)section {
model.isSelect = NO;
}
model.isSelect = YES;
self.isPayTypeChangeCauseReload=YES;
self.payTypeStr = model.payType;
[self.tableView reloadData];
}
......@@ -570,67 +443,142 @@ heightForFooterInSection:(NSInteger)section {
#pragma mark 支付相关;
-(void)confirmBtnFuc{
BOOL sss = NO;
for (ZXPayTypeModel *s in self.dataArray) {
if (s.isSelect == 1) {
sss = YES;
}
}
if (sss == NO) {
[ZXTool showText:@"请选择支付方式"];
return;
}
confirmBtn.enabled = NO;
NSInteger payType = 0;
for (ZXPayTypeModel *m in self.dataArray) {
if (m.isSelect==1) {
if ([m.topic isEqualToString:@"微信充值"]) {
self.payTypeStr=@"wx";
payType = 2;
}else if ([m.topic isEqualToString:@"支付宝充值"]){
self.payTypeStr=@"ali";
payType = 3;
}else if ([m.topic isEqualToString:@"京东充值"]){
self.payTypeStr=@"jd";
payType = 4;
}
}
}
//充值改造
ZXConfirmPayViewController *confirmVc = [[ZXConfirmPayViewController alloc] init];
confirmVc.payType = self.payTypeStr;
if ([self.comeFrom isEqualToString:@"firstTopUp"]) {
//首冲
confirmVc.rechargeId = 0;
confirmVc.rechargeDesc = [NSString stringWithFormat:@"充%.2f元送%@%@个",self.selectFirstTopUpItem.rechargeMoney,self.selectFirstTopUpItem.giveName, self.selectFirstTopUpItem.giveBean];
confirmVc.rechargeDesc = [NSString stringWithFormat:@"充%.2f元送%@%.2f个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, self.selectTopUpItem.giveMoney];
} else {
confirmVc.rechargeId = self.selectTopUpItem.rechargeId;
confirmVc.rechargeDesc = [NSString stringWithFormat:@"充%.2f元送%@%ld个",self.selectTopUpItem.rechargeVal,self.selectTopUpItem.giveName, (long)self.selectTopUpItem.giveVal];
confirmVc.rechargeId = self.selectTopUpItem.id;
confirmVc.rechargeDesc = [NSString stringWithFormat:@"充%.2f元送%@%ld个",self.selectTopUpItem.rechargeMoney,self.selectTopUpItem.giveName, (long)self.selectTopUpItem.giveMoney];
}
@weakify(self);
confirmVc.payCompletedAction = ^{
@strongify(self);
_isPaySuccessCauseReload=YES;
// 如果继续充值还会去首充; 清空来自首充记录,
self.comeFrom=@"";
[self FetchAccountDataFromSerVer:self.isNeedOld];
[self.topUpDataModel fetchTopUpeData];
[self zx_new_get_recharge_info];
};
[self.navigationController pushViewController:confirmVc animated:YES];
// [self requestPay:[self.comeFrom isEqualToString:@"firstTopUp"]?0:(long)self.selectTopUpItem.rechargeId payType:payType];
// //老版本代码
// if ([self.comeFrom isEqualToString:@"firstTopUp"]) {
// // 首充
// [self.payModel payWithRechargeId:@"0" OrderName:@"orderName" actualAmount:[NSString stringWithFormat:@"%.2f",self.selectFirstTopUpItem.rechargeMoney] payType:self.payTypeStr];
// }else{
// //正常充
// // 调用接口生成订单
//
// [self.payModel payWithRechargeId:[NSString stringWithFormat:@"%ld",(long)self.selectTopUpItem.rechargeId] OrderName:@"orderName" actualAmount: [NSString stringWithFormat:@"%.2f",self.selectTopUpItem.rechargeVal]payType:self.payTypeStr];
// }
}
#pragma mark - ========== 重构部分内容 ==========
/*获取最新的充值项和充值方式*/
- (void) zx_new_get_recharge_info {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/paymentAndActiveConf/getRechargeConf?areaId=%@&customerId=%@", [kUserDefaults valueForKey:@"SX_MONEY"], [kUserDefaults valueForKey:@"campusId"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error];
});
} else {
/*支付方式列表**/
NSArray *pay_list = common.data[@"listPayList"];
NSMutableSet *set = [[NSMutableSet alloc] init];
for (NSDictionary *dic in pay_list) {
if ([dic[@"id"] integerValue] == 2) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"weixin";
m.topic = @"微信充值";
m.payType = @"2";
[set addObject:m];
} else if ([dic[@"id"] integerValue] == 3) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"zhifubao";
m.topic = @"支付宝充值";
m.payType = @"3";
[set addObject:m];
} else if ([dic[@"id"] integerValue] == 4) {
ZXPayTypeModel *m = [[ZXPayTypeModel alloc] init];
m.icon = @"JD";
m.topic = @"京东充值";
m.payType = @"4";
[set addObject:m];
}
}
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:[set allObjects]];
ZXPayTypeModel *m = self.dataArray.firstObject;
m.isSelect = YES;
self.payTypeStr = m.payType;
/*是否已经首冲**/
NSInteger isFirst = [common.data[@"isFirstRecharge"] integerValue];
if (isFirst) {
self.comeFrom = @"";
} else {
self.comeFrom = @"firstTopUp";
}
/*充值项列表**/
NSArray *recharge_list = common.data[@"listRechargeConfDetail"];
[self.rechargeList removeAllObjects];
for (int i = 0; i < recharge_list.count; i++) {
NSDictionary *dic = recharge_list[i];
ZX_recharge_item *item = [ZX_recharge_item mj_objectWithKeyValues:dic];
item.isSelect = NO;
if (i == 0) {
item.isSelect = YES;
self.selectTopUpItem = item;
}
[self.rechargeList addObject:item];
}
dispatch_async(dispatch_get_main_queue(), ^{
if (self.rechargeList.count && self.dataArray.count) {
[self createFooter];
}
[self.tableView reloadData];
});
}
}];
}
#pragma mark - ========== 选中了某个充值项 ==========
- (void) chooseRechargeItem:(ZX_recharge_item *) item {
for (ZX_recharge_item *s_item in self.rechargeList) {
s_item.isSelect = NO;
}
item.isSelect = YES;
self.selectTopUpItem = item;
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
-(CGFloat)CellHeigh{
CGFloat cellHeight;
if (self.rechargeList.count>0) {
if (self.rechargeList.count%3==0) {
cellHeight= (self.rechargeList.count/3) * 58+self.rechargeList.count/3*10;
}
else{
cellHeight= (self.rechargeList.count/3+1) * 58+self.rechargeList.count/3*10;
}
}else{
return cellHeight= (self.rechargeList.count/3+1) * 58+self.rechargeList.count/3*10;
}
return cellHeight;
}
//- (id) findItemFromList:(NSArray *)list by:(NSInteger) key {
//
// NSInteger index = list.count / 2;
// id item = list[index];
// if ([item[@"key"] integerValue] == key) {
// return item;
// } else if (key > [item[@"key"] integerValue]) {
// NSArray *subArray = [list subarrayWithRange:NSMakeRange(index, list.count-1)];
// return [self findItemFromList:subArray by:key];
// }
// NSArray *subArray = [list subarrayWithRange:NSMakeRange(0, index)];
// return [self findItemFromList:subArray by:key];
//}
@end
//
//
......@@ -80,15 +80,15 @@
make.width.height.mas_equalTo(20 * k6Scale);
make.centerY.equalTo(payStyleLabel.mas_centerY);
}];
if ([self.payType isEqualToString:@"wx"]) {
if ([self.payType isEqualToString:@"2"]) {
payStyleLabel.text = @"微信充值";
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"weixin"].CGImage);
payTypeValue = 2;
} else if ([self.payType isEqualToString:@"ali"]) {
} else if ([self.payType isEqualToString:@"3"]) {
payStyleLabel.text = @"支付宝充值";
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"zhifubao"].CGImage);
payTypeValue = 3;
} else if ([self.payType isEqualToString:@"jd"]) {
} else if ([self.payType isEqualToString:@"4"]) {
payStyleLabel.text = @"京东充值";
payTypeValue = 4;
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"JD"].CGImage);
......@@ -171,33 +171,66 @@
#pragma mark - ========== 创建充值订单 ==========
- (void) requestPay:(NSInteger) rechageId payType:(NSInteger) payType {
NSString *userId = [kUserDefaults valueForKey:@"userId"];
@weakify(self);
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/customer/recharge?customerId=%@&rechargeId=%ld&payWay=%ld", [kUserDefaults valueForKey:@"Recharge"],userId, (long)rechageId, (long)payType] para:nil completed:^(CommonModel *common, NSString *error) {
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
confirmBtn.enabled = YES;
if (error) {
[ZXTool hideLoadingAnimation];
[ZXTool showText:error];
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showLoadingAnimation];
});
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@weakify(self);
[XMCenter sendRequest:^(XMRequest *request) {
@strongify(self);
request.url = [[NSString stringWithFormat:@"%@/dcxy/app/rechargeOrder/rechargeOrder/sure", [kUserDefaults valueForKey:@"NEW_PAY"]] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
request.httpMethod = kXMHTTPMethodPOST;
request.headers = @{@"token": CacheToken,@"reqSource":@"app", @"Content-Type":@"application/json"};
request.HttpBody = [[ZXTool dictionaryToJson:@{@"customerId":userId, @"id":@(self.rechargeId),@"isFirstRecharge":self.rechargeId==0?@"0":@"1", @"rechargeType":self.payType}] mj_JSONData];
} onSuccess:^(id responseObject) {
@strongify(self);
if ([responseObject[@"code"] integerValue] == 1000) {
dispatch_async(dispatch_get_main_queue(), ^{
confirmBtn.enabled = YES;
NSString *payTypeStr = @"";
if ([self.payType isEqualToString:@"2"]) {
payTypeStr = @"wx";
} else if ([self.payType isEqualToString:@"3"]) {
payTypeStr = @"ali";
} else if ([self.payType isEqualToString:@"3"]) {
payTypeStr = @"jd";
}
NSString *response = [ZXTool decryptResult:responseObject[@"payStr"] payType:payTypeStr];
[self createOrderSuccessThanStartPayByResponse:response];
});
} else {
[ZXTool hideLoadingAnimation];
NSString *response = [ZXTool decryptResult:common.data[@"payStr"] payType:self.payType];
[self createOrderSuccessThanStartPayByResponse:response];
dispatch_async(dispatch_get_main_queue(), ^{
if ([responseObject[@"code"] integerValue] == -2) {
[ZXTool backToLogin];
} else {
[ZXTool showText:responseObject[@"msg"]];
}
});
}
});
}];
} onFailure:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error.userInfo[@"NSLocalizedDescription"]];
});
} onFinished:^(id responseObject, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
});
}];
});
}
#pragma mark - ========== 订单创建成功-发起支付 ==========
- (void) createOrderSuccessThanStartPayByResponse:(NSString *) responseString {
if ([self.payType isEqualToString:@"wx"]) {
if ([self.payType isEqualToString:@"2"]) {
NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString];
payModelItem *payModel = [payModelItem mj_objectWithKeyValues:dic];
[self payWithData:payModel AliData:nil];
}else if ([self.payType isEqualToString:@"ali"]){
}else if ([self.payType isEqualToString:@"3"]){
[self payWithData:nil AliData:responseString];
}else if ([self.payType isEqualToString:@"jd"]){
}else if ([self.payType isEqualToString:@"4"]){
NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString];
NSString *merchant = dic[@"merchant"];
NSString *key = dic[@"md5Key"];
......@@ -218,7 +251,7 @@
#pragma mark - ========== 调起SDK 发起支付 ==========
- (void)payWithData:(payModelItem*)payItem AliData:(NSString *)aliData{
if ([self.payType isEqualToString:@"wx"]) {
if ([self.payType isEqualToString:@"2"]) {
// 微信支付
[WXApi registerApp:payItem.appid];
......
//
//
......@@ -16,4 +16,6 @@
@property (nonatomic, copy) NSString *icon;
@property (nonatomic, copy) NSString *topic;
@property (nonatomic, copy) NSString *payType;
@end
//
//
// ZX_recharge_item.h
// ColorfulSchool
//
// Created by liuZX on 2019/3/12.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface ZX_recharge_item : JKDBModel
@property (nonatomic, assign) NSInteger id;
@property (nonatomic, assign) NSInteger giveId;
@property (nonatomic, assign) CGFloat rechargeMoney;
@property (nonatomic, copy) NSString *giveName;
@property (nonatomic, assign) CGFloat giveMoney;
@property (nonatomic, assign) BOOL isSelect;
@end
NS_ASSUME_NONNULL_END
//
//
// ZX_recharge_item.m
// ColorfulSchool
//
// Created by liuZX on 2019/3/12.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZX_recharge_item.h"
@implementation ZX_recharge_item
@end
//
//
......@@ -7,7 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "FetchWalletTopUpDataModel.h"
#import "ZX_recharge_item.h"
@interface TopUpCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *presentBeanLabel;
......@@ -20,7 +20,7 @@
*/
//@property (nonatomic) TopUpDataItem * topUpDataItem;
@property (nonatomic) id topUpDataItem;
-(void)setUpUIWithString:(NSString *)str;
@property (nonatomic, strong) ZX_recharge_item *topUpDataItem;
@end
//
//
......@@ -14,54 +14,20 @@
[super awakeFromNib];
// Initialization code
}
-(void)setTopUpDataItem:(id)topUpDataItem{
- (void)setTopUpDataItem:(ZX_recharge_item *)topUpDataItem {
_topUpDataItem = topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",_topUpDataItem.rechargeMoney];
if ([topUpDataItem isKindOfClass:[TopUpDataItem class]]) {
//正常充
TopUpDataItem * DataItem=( TopUpDataItem*)topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",DataItem.rechargeVal];
if (DataItem.giveVal==0) {
self.presentBeanLabel.hidden=YES;
self.priceLabelTopConstraint.constant=8;
}else{
self.presentBeanLabel.hidden=NO;
self.priceLabelTopConstraint.constant=0;
}
self.presentBeanLabel.text=[NSString stringWithFormat:@"送%@%ld个",DataItem.giveName, (long)DataItem.giveVal];
if (_topUpDataItem.giveMoney==0) {
self.presentBeanLabel.hidden=YES;
self.priceLabelTopConstraint.constant=8;
}else{
self.presentBeanLabel.hidden=NO;
self.priceLabelTopConstraint.constant=0;
}
else{
//首充
FirstTopUpDataItem * DataItem=topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",DataItem.rechargeMoney];
if ([DataItem.giveBean isEqualToString:@"0"]) {
self.presentBeanLabel.hidden=YES;
self.priceLabelTopConstraint.constant=8;
}else{
self.presentBeanLabel.hidden=NO;
self.priceLabelTopConstraint.constant=0;
}
self.presentBeanLabel.text=[NSString stringWithFormat:@"送%@%@个",DataItem.giveName, DataItem.giveBean];
}
}
-(void)setUpUIWithString:(NSString *)str{
if ([str isEqualToString:@"1"]) {
self.presentBeanLabel.text=[NSString stringWithFormat:@"送%@%ld个",_topUpDataItem.giveName, (long)_topUpDataItem.giveMoney];
if (_topUpDataItem.isSelect) {
//选中状态;
self.cellBgView.backgroundColor=[UIColor colorWithHexString:@"#57BDEE"];
self.cellBgView.layer.masksToBounds=YES;
......@@ -70,17 +36,18 @@
self.cellBgView.layer.borderWidth=1;
self.priceLabel.textColor=[UIColor whiteColor];
self.presentBeanLabel.textColor=[UIColor whiteColor];
}
else{
} else {
//未选中状态
self.cellBgView.backgroundColor=[UIColor whiteColor];
self.cellBgView.layer.masksToBounds=YES;
self.cellBgView.layer.cornerRadius=4;
self.cellBgView.layer.borderColor=[UIColor colorWithHexString:@"#57BDEE"].CGColor;
self.cellBgView.layer.borderWidth=1;
self.priceLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"];
self.presentBeanLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"];
}
}
@end
//
//
......@@ -7,14 +7,14 @@
//
#import <UIKit/UIKit.h>
#import "FetchWalletTopUpDataModel.h"
#import "ZX_recharge_item.h"
@interface TopupWalletCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *collectionBgView;
@property(nonatomic)NSMutableArray * topUpArray;
@property(nonatomic,assign)CGFloat collectionViewHeigh;
@property(nonatomic)void(^mySelectTopUpItem)(TopUpDataItem * item);
@property(nonatomic)void(^mySelectFirstTopUpItem)(FirstTopUpDataItem * item);
@property(nonatomic, copy)void(^mySelectTopUpItem)(ZX_recharge_item * item);
-(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh;
......
//
//
......@@ -20,9 +20,6 @@ static CGFloat const margin = 11;
@property (nonatomic, strong) UICollectionView *collectionView1;
@property (nonatomic)NSMutableArray * topUpSelectArray;
@property (nonatomic)TopUpDataItem * selectTopUpItem;
@end
......@@ -31,7 +28,6 @@ static CGFloat const margin = 11;
- (void)awakeFromNib {
[super awakeFromNib];
self.topUpArray=[NSMutableArray array];
self.topUpSelectArray =[NSMutableArray array];
[self creatCollectionView];
// Initialization code
}
......@@ -79,64 +75,22 @@ static CGFloat const margin = 11;
id dataItem=self.topUpArray[indexPath.row];
cell.topUpDataItem=dataItem;
}
if (indexPath.row<self.topUpSelectArray.count) {
[cell setUpUIWithString:self.topUpSelectArray[indexPath.row]];
}
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
[self.topUpSelectArray removeAllObjects];
[self setUpSeletArrayWithSelectIndex:(int)indexPath.row];
if (indexPath.row<self.topUpArray.count) {
id dataItem=self.topUpArray[indexPath.row];
if ([dataItem isKindOfClass:[TopUpDataItem class]]) {
//正常充
TopUpDataItem * selectItem=(TopUpDataItem *)dataItem;
self.mySelectTopUpItem(selectItem);
}else{
//首充
FirstTopUpDataItem * selectItem=(FirstTopUpDataItem *)dataItem;
self.mySelectFirstTopUpItem(selectItem);
}
id dataItem=self.topUpArray[indexPath.row];
if (self.mySelectTopUpItem) {
self.mySelectTopUpItem(dataItem);
}
[self.collectionView1 reloadData];
}
-(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh{
self.collectionViewHeigh=collectionViewHeigh;
self.topUpArray=topUpArray;
[self setUpSeletArrayWithSelectIndex:0];
//+2让切割一像素显示;
_collectionView1.frame=CGRectMake(12, 0,kWidth-24,self.collectionViewHeigh+2);
[self.collectionView1 reloadData];
}
-(void)setUpSeletArrayWithSelectIndex:(int)index{
//首充切换
if (self.topUpSelectArray.count>0) {
[self.topUpSelectArray removeAllObjects];
}
for (int i=0; i<self.topUpArray.count; i++) {
if (i==index) {
[self.topUpSelectArray addObject:@"1"];
}else{
[self.topUpSelectArray addObject:@"0"];
}
}
}
@end
//
//
......@@ -12,21 +12,22 @@
#import "updateViewController.h"
#import "AllowEequipCountLoginModel.h"
#import "LoginModel.h"
#define CachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
@interface UserSettingViewController ()<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray * dataArray;
NSMutableArray * imageArray;
NSMutableArray * sectionTitle;
UILabel *cacheNum;
UISwitch * switchButton;
UISwitch * free_switch_Button;
UISwitch * free_switch_Button;
}
@property (nonatomic, assign) NSInteger isOpenFreePay;
@property (nonatomic, assign) NSInteger totalSize;
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) AllowEequipCountLoginModel * allowModel;
@property (nonatomic, assign) NSInteger isOpenFreePay;
@end
@implementation UserSettingViewController
......@@ -37,29 +38,29 @@
-(void)registNotificationAndKVO{
[self.allowModel addObserver:self forKeyPath:@"isLoaded" options:NSKeyValueObservingOptionNew context:nil];
[self.allowModel addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)removeNotificationAndKVO{
[self.allowModel removeObserver:self forKeyPath:@"isLoaded"];
[self.allowModel removeObserver:self forKeyPath:@"error"];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if (object == self.allowModel) {
if ([keyPath isEqualToString:@"isLoaded"]) {
}
else{
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
self.isOpenFreePay = 0;
[self loadCache];
......@@ -70,26 +71,25 @@
self.tableView.delegate=self;
self.tableView.dataSource=self;
self.tableView.tableFooterView=[UIView new];
[ZXTool loadAdInfoByAdId:@"5" topView:self.tableView superView:self.view fromVc:self];
[self loadIsOpenFreePay];
[ZXTool loadAdInfoByAdId:@"5" topView:self.tableView superView:self.view fromVc:self];
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
super.navigationController.navigationBar.hidden = NO;
}
//获取缓存尺寸
//获取缓存尺寸
-(void)loadCache{
// 获取文件夹尺寸
// 文件夹非常小,如果我的文件非常大
[XMGFileTool getFileSize:CachePath completion:^(NSInteger totalSize) {
_totalSize = totalSize;
[self.tableView reloadData];
}];
}
// 获取缓存尺寸字符串
......@@ -110,7 +110,7 @@
// B
sizeStr = [NSString stringWithFormat:@"%.ldB",totalSize];
}
return sizeStr;
}
/*
......@@ -118,7 +118,7 @@
*/
-(void)loadData
{
NSArray* group1;
BOOL isOpenFreePay = [[kUserDefaults valueForKey:@"isOpenFreePay"] isEqualToString:@"yes"];
......@@ -180,45 +180,45 @@ heightForFooterInSection:(NSInteger)section
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return dataArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray * arr=dataArray[section];
return arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:@"MCCMineCell"];
UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:@"MCCMineCell"];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MCCMineCell"];
}
NSArray * tempArr;
if (indexPath.section<dataArray.count) {
tempArr=dataArray[indexPath.section];
tempArr=dataArray[indexPath.section];
}
UIImage * image=[UIImage imageNamed:(imageArray[indexPath.section])[indexPath.row]];
cell.imageView.image=image;
cell.textLabel.text=(tempArr)[indexPath.row];
cell.selectionStyle= UITableViewCellSelectionStyleNone;
cell.separatorInset=UIEdgeInsetsMake(0, 10, 0, 0);
if (!(indexPath.section==1&&indexPath.row==0)) {
if ([CacheVersion isEqualToString:@"2"]) {
if (indexPath.section==0&&indexPath.row==3){
[self addSwithWithCell:cell];
[self addSwithWithCell:cell];
} else if (indexPath.section==0&&indexPath.row==4) {
[self addFreeSwithWithCell:cell];
} else{
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
}else{
if (indexPath.section==0&&indexPath.row==2){
......@@ -226,12 +226,12 @@ heightForFooterInSection:(NSInteger)section
} else if (indexPath.section==0&&indexPath.row==3) {
[self addFreeSwithWithCell:cell];
} else{
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
}
}
else{
if (cacheNum) {
[cacheNum removeFromSuperview];
......@@ -250,6 +250,37 @@ heightForFooterInSection:(NSInteger)section
}
return cell;
}
-(void)addSwithWithCell:(UITableViewCell *)cell {
if (switchButton) {
[switchButton removeFromSuperview];
switchButton=nil;
}
switchButton = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
if ([CacheDevPassSwitch integerValue] == 0) {
[switchButton setOn:YES];
}else{
[switchButton setOn:NO];
}
switchButton.onTintColor=[UIColor orangeColor];
[switchButton addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:switchButton];
}
#pragma mark - ========== 单独加载是否开启绵密支付 ==========
- (void) loadIsOpenFreePay {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/customer/balance/state?customerId=%@", [kUserDefaults valueForKey:@"NEW_PAY"],CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error==nil) {
self.isOpenFreePay = [common.data integerValue];
[self.tableView reloadData];
}
});
}];
}
-(void)addFreeSwithWithCell:(UITableViewCell *)cell {
if (free_switch_Button) {
[free_switch_Button removeFromSuperview];
......@@ -257,8 +288,8 @@ heightForFooterInSection:(NSInteger)section
}
free_switch_Button = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
NSInteger is = [[kUserDefaults valueForKey:@"IS_OPEN_FREE_PAY"] integerValue];
if (is) {
if (self.isOpenFreePay) {
[free_switch_Button setOn:YES];
}else{
[free_switch_Button setOn:NO];
......@@ -284,76 +315,30 @@ heightForFooterInSection:(NSInteger)section
});
}];
}
#pragma mark - ========== 单独加载是否开启绵密支付 ==========
- (void) loadIsOpenFreePay {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/customer/balance/state?customerId=%@", [kUserDefaults valueForKey:@"NEW_PAY"],CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error==nil) {
self.isOpenFreePay = [common.data integerValue];
[self.tableView reloadData];
}
});
}];
}
-(void)addSwithWithCell:(UITableViewCell *)cell {
if (switchButton) {
[switchButton removeFromSuperview];
switchButton=nil;
}
switchButton = [[UISwitch alloc] initWithFrame:CGRectMake(kWidth-70, 7, 100, 24)];
// 0开1关
if ([CacheDevPassSwitch isEqualToString:@"0"]) {
[switchButton setOn:YES];
}else{
[switchButton setOn:NO];
}
switchButton.onTintColor=[UIColor orangeColor];
[switchButton addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:switchButton];
}
-(void)switchAction:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
BOOL isButtonOn = [switchButton isOn];
if (isButtonOn) {
// showSwitchValue.text = @"是";
// 0开1关
[self.allowModel AllowEquitLoginWithStatu:@"0"];
[ZXTool requestDataWithType:kXMHTTPMethodPUT url:[NSString stringWithFormat:@"%@/app/customer/switch/%@/%d", [kUserDefaults valueForKey:@"NEW_PAY"], CacheUserId, isButtonOn] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if (isButtonOn) {
[ZXTool showText:@"开启设备登录密码成功"];
} else {
[ZXTool showText:@"关闭设备登录密码成功"];
}
}
});
}];
// if (isButtonOn) {
//// showSwitchValue.text = @"是";
//// 0开1关
// [self.allowModel AllowEquitLoginWithStatu:@"0"];
//
// }else {
//// showSwitchValue.text = @"否";
// [self.allowModel AllowEquitLoginWithStatu:@"1"];
// }
}else {
// showSwitchValue.text = @"否";
[self.allowModel AllowEquitLoginWithStatu:@"1"];
}
}
-(UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size
{
UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage; //返回的就是已经改变的图片
}
......@@ -370,25 +355,29 @@ heightForFooterInSection:(NSInteger)section
return BgView;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
// NSLog(@"%d-%d",indexPath.section,indexPath.row);
// NSLog(@"%d-%d",indexPath.section,indexPath.row);
if (indexPath.section==1) {
if (indexPath.row==0) {
[self cacheBtnFuc];
[self cacheBtnFuc];
}
else if (indexPath.row==1){
[self exitBtnFuc];
}
} else if(indexPath.section==0) {
NSArray *tempArr=dataArray[indexPath.section];
NSString *s = tempArr[indexPath.row];
if (![s isEqualToString:@"开启设备登录密码"] || [s isEqualToString:@"钱包免密支付"]) {
//app登录密码
updateViewController * VC=[[updateViewController alloc] init];
VC.titleStr=s;
[self.navigationController pushViewController:VC animated:YES];
}
else if(indexPath.section==0)
{
NSArray * tempArr;
tempArr=dataArray[indexPath.section];
NSString *s = (tempArr)[indexPath.row];
if ([s isEqualToString:@"开启设备登录密码"] || [s isEqualToString:@"钱包免密支付"]) {
return;
}
//app登录密码
updateViewController * VC=[[updateViewController alloc] init];
VC.titleStr=s;
[self.navigationController pushViewController:VC animated:YES];
}
}
/*
......@@ -396,7 +385,7 @@ heightForFooterInSection:(NSInteger)section
*/
-(void)cacheBtnFuc
{
NSLog(@" 缓存");
// 清空缓存
// 删除文件夹里面所有文件
......@@ -404,7 +393,7 @@ heightForFooterInSection:(NSInteger)section
_totalSize = 0;
[self.tableView reloadData];
[SVProgressHUD showSuccessWithStatus:@"清除缓存成功"];
}
/*
退出按钮
......@@ -421,13 +410,13 @@ heightForFooterInSection:(NSInteger)section
}
/*
#pragma mark - Navigation
#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.
}
*/
// 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
//
//
......@@ -344,12 +344,14 @@ static NSInteger seq = 0;
[self.navigationController.navigationBar setHidden:YES];
[self.tabBarController.tabBar setHidden:NO];
if ([[kUserDefaults valueForKey:@"isUploadLog"] integerValue]) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSArray *list = [ExpecptionModel findByCriteria:[NSString stringWithFormat:@"where uploadStatus <> 1"]];
if (list.count) {
NSArray *list = [ExpecptionModel findByCriteria:[NSString stringWithFormat:@"where uploadStatus <> 1"]];
if (list.count>10) {
[ExpecptionModel clearTable];
} else {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self uploadExpectionWithList:list];
}
});
});
}
} else {
[ExpecptionModel clearTable];
}
......@@ -360,12 +362,9 @@ static NSInteger seq = 0;
#pragma mark - ========== 上传异常信息 ==========
- (void) uploadExpectionWithList:(NSArray *) list {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (ExpecptionModel *exp in list) {
[self uploadItem:exp];
}
});
if (list.count) {
[self uploadItem:list.firstObject];
}
}
- (void) uploadItem:(ExpecptionModel *) exp {
......
//
//
......@@ -34,13 +34,13 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool)
#pragma mark - ========== 开屏广告 ==========
-(void) createLauchAdByPlacmentId:(NSString *) placenmentId {
// if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
// GDTSplashAd *splash = [[GDTSplashAd alloc] initWithAppId:kTXAdAPPID placementId:placenmentId];
// splash.delegate = self;
// splash.fetchDelay = 3;
// [splash loadAdAndShowInWindow:kAppWindow];
// self.splash = splash;
// }
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
GDTSplashAd *splash = [[GDTSplashAd alloc] initWithAppId:kTXAdAPPID placementId:placenmentId];
splash.delegate = self;
splash.fetchDelay = 3;
[splash loadAdAndShowInWindow:kAppWindow];
self.splash = splash;
}
}
- (void)splashAdApplicationWillEnterBackground:(GDTSplashAd *)splashAd
{
......
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