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
//
//
......@@ -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"];
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showLoadingAnimation];
});
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@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) {
[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;
if (error) {
[ZXTool hideLoadingAnimation];
[ZXTool showText:error];
} else {
[ZXTool hideLoadingAnimation];
NSString *response = [ZXTool decryptResult:common.data[@"payStr"] payType:self.payType];
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 {
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{
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];
}
else{
//首充
FirstTopUpDataItem * DataItem=topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",DataItem.rechargeMoney];
if ([DataItem.giveBean isEqualToString:@"0"]) {
- (void)setTopUpDataItem:(ZX_recharge_item *)topUpDataItem {
_topUpDataItem = topUpDataItem;
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",_topUpDataItem.rechargeMoney];
if (_topUpDataItem.giveMoney==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,8 +36,7 @@
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;
......@@ -83,4 +48,6 @@
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);
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,6 +12,7 @@
#import "updateViewController.h"
#import "AllowEequipCountLoginModel.h"
#import "LoginModel.h"
#define CachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
@interface UserSettingViewController ()<UITableViewDataSource,UITableViewDelegate>
{
......@@ -23,10 +24,10 @@
UISwitch * switchButton;
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
......@@ -70,17 +71,16 @@
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{
// 获取文件夹尺寸
......@@ -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,65 +315,19 @@ 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];
[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:@"关闭设备登录密码成功"];
}
// showSwitchValue.text = @"是";
// 0开1关
[self.allowModel AllowEquitLoginWithStatu:@"0"];
}else {
// showSwitchValue.text = @"否";
[self.allowModel AllowEquitLoginWithStatu:@"1"];
}
});
}];
// if (isButtonOn) {
//// showSwitchValue.text = @"是";
//// 0开1关
// [self.allowModel AllowEquitLoginWithStatu:@"0"];
//
// }else {
//// showSwitchValue.text = @"否";
// [self.allowModel AllowEquitLoginWithStatu:@"1"];
// }
}
-(UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size
{
......@@ -370,7 +355,7 @@ 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];
......@@ -379,17 +364,21 @@ heightForFooterInSection:(NSInteger)section
[self exitBtnFuc];
}
} else if(indexPath.section==0) {
}
else if(indexPath.section==0)
{
NSArray * tempArr;
NSArray *tempArr=dataArray[indexPath.section];
NSString *s = tempArr[indexPath.row];
if (![s isEqualToString:@"开启设备登录密码"] || [s isEqualToString:@"钱包免密支付"]) {
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];
}
}
}
/*
清理缓存
......@@ -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 {
// 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) {
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