Commit 9c34422c by liuZX

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

parent 03a219ed
...@@ -369,6 +369,7 @@ ...@@ -369,6 +369,7 @@
A770521B211D231D00798513 /* ZXDrinkService.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521A211D231D00798513 /* ZXDrinkService.m */; }; A770521B211D231D00798513 /* ZXDrinkService.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521A211D231D00798513 /* ZXDrinkService.m */; };
A770521E211D2F9E00798513 /* ZXDrinkAdModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521D211D2F9E00798513 /* ZXDrinkAdModel.m */; }; A770521E211D2F9E00798513 /* ZXDrinkAdModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A770521D211D2F9E00798513 /* ZXDrinkAdModel.m */; };
A7705221211D3A2B00798513 /* ZXDrinkMerthinModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A7705220211D3A2B00798513 /* ZXDrinkMerthinModel.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 */; }; A77315612123C35A00E57D6E /* ZXGoPutFreeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A77315602123C35A00E57D6E /* ZXGoPutFreeCell.m */; };
A77DE2CA20DB4ACD002FB903 /* washingsss.gif in Resources */ = {isa = PBXBuildFile; fileRef = A77DE2C920DB4ACC002FB903 /* washingsss.gif */; }; A77DE2CA20DB4ACD002FB903 /* washingsss.gif in Resources */ = {isa = PBXBuildFile; fileRef = A77DE2C920DB4ACC002FB903 /* washingsss.gif */; };
A77DE2CD20DB6F55002FB903 /* ZXLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A77DE2CC20DB6F55002FB903 /* ZXLocationViewController.m */; }; A77DE2CD20DB6F55002FB903 /* ZXLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A77DE2CC20DB6F55002FB903 /* ZXLocationViewController.m */; };
...@@ -1330,6 +1331,8 @@ ...@@ -1330,6 +1331,8 @@
A770521D211D2F9E00798513 /* ZXDrinkAdModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXDrinkAdModel.m; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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 @@ ...@@ -2287,6 +2290,8 @@
A7C305F321EEF5C0004F06C3 /* ZXSXModel.m */, A7C305F321EEF5C0004F06C3 /* ZXSXModel.m */,
A7DA71CA214BB38000A21658 /* ZXPayTypeModel.h */, A7DA71CA214BB38000A21658 /* ZXPayTypeModel.h */,
A7DA71CB214BB38000A21658 /* ZXPayTypeModel.m */, A7DA71CB214BB38000A21658 /* ZXPayTypeModel.m */,
A77097E32237A7A4002D9D97 /* ZX_recharge_item.h */,
A77097E42237A7A4002D9D97 /* ZX_recharge_item.m */,
); );
path = Modle; path = Modle;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -5109,6 +5114,7 @@ ...@@ -5109,6 +5114,7 @@
A705C02021D4B067004F1628 /* MWZoomingScrollView.m in Sources */, A705C02021D4B067004F1628 /* MWZoomingScrollView.m in Sources */,
A756C5AF21F9B5960006E418 /* ZXNewPayOrderListViewController.m in Sources */, A756C5AF21F9B5960006E418 /* ZXNewPayOrderListViewController.m in Sources */,
A75436E121D34567005584CC /* FetchCheckCodeModel.m in Sources */, A75436E121D34567005584CC /* FetchCheckCodeModel.m in Sources */,
A77097E52237A7A4002D9D97 /* ZX_recharge_item.m in Sources */,
A7F3E1C321B5350600010E23 /* unzip.c in Sources */, A7F3E1C321B5350600010E23 /* unzip.c in Sources */,
22704B071F481B0A00B8D786 /* ChangePassWordModel.m in Sources */, 22704B071F481B0A00B8D786 /* ChangePassWordModel.m in Sources */,
A7265BF420CA45690084B814 /* GYRollingNoticeView.m in Sources */, A7265BF420CA45690084B814 /* GYRollingNoticeView.m in Sources */,
......
...@@ -13,5 +13,21 @@ ...@@ -13,5 +13,21 @@
stopOnStyle = "0"> stopOnStyle = "0">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </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> </Breakpoints>
</Bucket> </Bucket>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
// [userDefaults setObject:@"http://192.168.1.102:8000" forKey:@"NEW_PAY"]; // [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 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 setValue:@"http://121.15.180.66:801/netpayment/BaseHttp.dll?MB_EUserPay" forKey:@"YWT_PAY"];
[userDefaults synchronize]; [userDefaults synchronize];
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
_isPlaying = NO; _isPlaying = NO;
[self defaultConfig]; [self defaultConfig];
//启动环境 //启动环境
[self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentTest]; [self configSystemAPIByEnvironment:ZXColorfulSchoolEnvironmentProduct];
//极光推送 //极光推送
[self initPushWithOptions:launchOptions isProduct:kJPushIsProduct]; [self initPushWithOptions:launchOptions isProduct:kJPushIsProduct];
//网络监测 //网络监测
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
if (CacheToken&&![CacheToken isEqualToString:@""])//如果登录了 if (CacheToken&&![CacheToken isEqualToString:@""])//如果登录了
{ {
[ZXTool loginSuccessJump:^(NSString *jump) { [ZXTool loginSuccessJump:^(NSString *jump) {
jump = @"DC_02";
if ([jump isEqualToString:@"NONE"]) { if ([jump isEqualToString:@"NONE"]) {
//先读取缓存 //先读取缓存
NSArray *list = [LoginJump findAll]; NSArray *list = [LoginJump findAll];
...@@ -150,6 +150,8 @@ ...@@ -150,6 +150,8 @@
[info update]; [info update];
} }
}); });
//创建开屏广告
[[ZXTXAdTool sharedZXTXAdTool] createLauchAdByPlacmentId:@"9090758636743260"];
[kUserDefaults setObject:[ZXTool getCurrentTimeStamp] forKey:@"uploadBatch"]; [kUserDefaults setObject:[ZXTool getCurrentTimeStamp] forKey:@"uploadBatch"];
if ([[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")]) { if ([[ZXTool getCurrentVC] isKindOfClass:NSClassFromString(@"ZXSelfHelpViewController")]) {
[kUserDefaults setObject:@([UIScreen mainScreen].brightness) forKey:@"defaultBright"]; [kUserDefaults setObject:@([UIScreen mainScreen].brightness) forKey:@"defaultBright"];
......
// //
...@@ -21,62 +21,15 @@ ...@@ -21,62 +21,15 @@
@end @end
@implementation LoginView @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 { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self setViews]; [self setViews];
self.loginModel=[LoginModel new]; self.loginModel=[LoginModel new];
[self registNotificationAndKVO];
self.userTF.text = CacheAccount; self.userTF.text = CacheAccount;
// self.passWorldTF.text = CachePassWord; // self.passWorldTF.text = CachePassWord;
self.userTF.delegate=self; self.userTF.delegate=self;
...@@ -155,8 +108,6 @@ ...@@ -155,8 +108,6 @@
return; return;
} }
[[UIApplication sharedApplication].keyWindow endEditing:YES]; [[UIApplication sharedApplication].keyWindow endEditing:YES];
// [self.loginModel loginWithPhoneNum:self.userTF.text password:self.passWorldTF.text];
[SVProgressHUD showWithStatus:@" 正在登录 ,请稍后 "]; [SVProgressHUD showWithStatus:@" 正在登录 ,请稍后 "];
[self startLoginByAccount:self.userTF.text password:self.passWorldTF.text]; [self startLoginByAccount:self.userTF.text password:self.passWorldTF.text];
} }
...@@ -240,21 +191,14 @@ ...@@ -240,21 +191,14 @@
// [userDefaults setObject:self.item.schoolName forKey:@"schoolName"]; // [userDefaults setObject:self.item.schoolName forKey:@"schoolName"];
[userDefaults setObject:user.studentNo forKey:@"studentNo"]; [userDefaults setObject:user.studentNo forKey:@"studentNo"];
[userDefaults setObject:user.customerName forKey:@"username"]; [userDefaults setObject:user.customerName forKey:@"username"];
[userDefaults setObject:@(!user.hardwareState) forKey:@"devPassSwitch"]; [userDefaults setObject:[NSString stringWithFormat:@"%ld", !user.hardwareState] forKey:@"devPassSwitch"];
[userDefaults setObject:@(user.isUploadLog) forKey:@"isUploadLog"]; [userDefaults setObject:[NSString stringWithFormat:@"%ld", !user.isUploadLog] forKey:@"isUploadLog"];
[userDefaults synchronize]; [userDefaults synchronize];
NSLog(@"====%@",CacheUserId); NSLog(@"====%@",CacheUserId);
} }
- (IBAction)registerBtnFuc:(id)sender { - (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]; UIViewController *vc = [[NSClassFromString(@"ZXRegistorViewController") alloc] init];
[self.navigationController pushViewController:vc animated:YES]; [self.navigationController pushViewController:vc animated:YES];
......
// //
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface AimiWalletViewController : UIViewController @interface AimiWalletViewController : UIViewController
@property (nonatomic) NSString * comeFrom; @property (nonatomic) NSString *comeFrom;
@end @end
// //
...@@ -80,15 +80,15 @@ ...@@ -80,15 +80,15 @@
make.width.height.mas_equalTo(20 * k6Scale); make.width.height.mas_equalTo(20 * k6Scale);
make.centerY.equalTo(payStyleLabel.mas_centerY); make.centerY.equalTo(payStyleLabel.mas_centerY);
}]; }];
if ([self.payType isEqualToString:@"wx"]) { if ([self.payType isEqualToString:@"2"]) {
payStyleLabel.text = @"微信充值"; payStyleLabel.text = @"微信充值";
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"weixin"].CGImage); icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"weixin"].CGImage);
payTypeValue = 2; payTypeValue = 2;
} else if ([self.payType isEqualToString:@"ali"]) { } else if ([self.payType isEqualToString:@"3"]) {
payStyleLabel.text = @"支付宝充值"; payStyleLabel.text = @"支付宝充值";
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"zhifubao"].CGImage); icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"zhifubao"].CGImage);
payTypeValue = 3; payTypeValue = 3;
} else if ([self.payType isEqualToString:@"jd"]) { } else if ([self.payType isEqualToString:@"4"]) {
payStyleLabel.text = @"京东充值"; payStyleLabel.text = @"京东充值";
payTypeValue = 4; payTypeValue = 4;
icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"JD"].CGImage); icon.layer.contents = (__bridge id _Nullable)([UIImage imageNamed:@"JD"].CGImage);
...@@ -171,33 +171,66 @@ ...@@ -171,33 +171,66 @@
#pragma mark - ========== 创建充值订单 ========== #pragma mark - ========== 创建充值订单 ==========
- (void) requestPay:(NSInteger) rechageId payType:(NSInteger) payType { - (void) requestPay:(NSInteger) rechageId payType:(NSInteger) payType {
NSString *userId = [kUserDefaults valueForKey:@"userId"]; 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) { dispatch_async(dispatch_get_main_queue(), ^{
@strongify(self); [ZXTool showLoadingAnimation];
dispatch_async(dispatch_get_main_queue(), ^{ });
confirmBtn.enabled = YES; dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (error) { @weakify(self);
[ZXTool hideLoadingAnimation]; [XMCenter sendRequest:^(XMRequest *request) {
[ZXTool showText:error]; @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 { } else {
[ZXTool hideLoadingAnimation]; dispatch_async(dispatch_get_main_queue(), ^{
NSString *response = [ZXTool decryptResult:common.data[@"payStr"] payType:self.payType]; if ([responseObject[@"code"] integerValue] == -2) {
[self createOrderSuccessThanStartPayByResponse:response]; [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 - ========== 订单创建成功-发起支付 ========== #pragma mark - ========== 订单创建成功-发起支付 ==========
- (void) createOrderSuccessThanStartPayByResponse:(NSString *) responseString { - (void) createOrderSuccessThanStartPayByResponse:(NSString *) responseString {
if ([self.payType isEqualToString:@"wx"]) { if ([self.payType isEqualToString:@"2"]) {
NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString]; NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString];
payModelItem *payModel = [payModelItem mj_objectWithKeyValues:dic]; payModelItem *payModel = [payModelItem mj_objectWithKeyValues:dic];
[self payWithData:payModel AliData:nil]; [self payWithData:payModel AliData:nil];
}else if ([self.payType isEqualToString:@"ali"]){ }else if ([self.payType isEqualToString:@"3"]){
[self payWithData:nil AliData:responseString]; [self payWithData:nil AliData:responseString];
}else if ([self.payType isEqualToString:@"jd"]){ }else if ([self.payType isEqualToString:@"4"]){
NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString]; NSDictionary *dic = [ZXTool dictionaryWithJsonString:responseString];
NSString *merchant = dic[@"merchant"]; NSString *merchant = dic[@"merchant"];
NSString *key = dic[@"md5Key"]; NSString *key = dic[@"md5Key"];
...@@ -218,7 +251,7 @@ ...@@ -218,7 +251,7 @@
#pragma mark - ========== 调起SDK 发起支付 ========== #pragma mark - ========== 调起SDK 发起支付 ==========
- (void)payWithData:(payModelItem*)payItem AliData:(NSString *)aliData{ - (void)payWithData:(payModelItem*)payItem AliData:(NSString *)aliData{
if ([self.payType isEqualToString:@"wx"]) { if ([self.payType isEqualToString:@"2"]) {
// 微信支付 // 微信支付
[WXApi registerApp:payItem.appid]; [WXApi registerApp:payItem.appid];
......
// //
...@@ -16,4 +16,6 @@ ...@@ -16,4 +16,6 @@
@property (nonatomic, copy) NSString *icon; @property (nonatomic, copy) NSString *icon;
@property (nonatomic, copy) NSString *topic; @property (nonatomic, copy) NSString *topic;
@property (nonatomic, copy) NSString *payType;
@end @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 @@ ...@@ -7,7 +7,7 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "FetchWalletTopUpDataModel.h" #import "ZX_recharge_item.h"
@interface TopUpCell : UICollectionViewCell @interface TopUpCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *priceLabel; @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *presentBeanLabel; @property (weak, nonatomic) IBOutlet UILabel *presentBeanLabel;
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
//@property (nonatomic) TopUpDataItem * topUpDataItem; //@property (nonatomic) TopUpDataItem * topUpDataItem;
@property (nonatomic) id topUpDataItem; @property (nonatomic, strong) ZX_recharge_item *topUpDataItem;
-(void)setUpUIWithString:(NSString *)str;
@end @end
// //
...@@ -14,54 +14,20 @@ ...@@ -14,54 +14,20 @@
[super awakeFromNib]; [super awakeFromNib];
// Initialization code // 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]]) { if (_topUpDataItem.giveMoney==0) {
//正常充 self.presentBeanLabel.hidden=YES;
self.priceLabelTopConstraint.constant=8;
TopUpDataItem * DataItem=( TopUpDataItem*)topUpDataItem; }else{
self.priceLabel.text=[NSString stringWithFormat:@"充%.2f元",DataItem.rechargeVal]; self.presentBeanLabel.hidden=NO;
self.priceLabelTopConstraint.constant=0;
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{ self.presentBeanLabel.text=[NSString stringWithFormat:@"送%@%ld个",_topUpDataItem.giveName, (long)_topUpDataItem.giveMoney];
//首充 if (_topUpDataItem.isSelect) {
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.cellBgView.backgroundColor=[UIColor colorWithHexString:@"#57BDEE"]; self.cellBgView.backgroundColor=[UIColor colorWithHexString:@"#57BDEE"];
self.cellBgView.layer.masksToBounds=YES; self.cellBgView.layer.masksToBounds=YES;
...@@ -70,17 +36,18 @@ ...@@ -70,17 +36,18 @@
self.cellBgView.layer.borderWidth=1; self.cellBgView.layer.borderWidth=1;
self.priceLabel.textColor=[UIColor whiteColor]; self.priceLabel.textColor=[UIColor whiteColor];
self.presentBeanLabel.textColor=[UIColor whiteColor]; self.presentBeanLabel.textColor=[UIColor whiteColor];
} } else {
else{
//未选中状态 //未选中状态
self.cellBgView.backgroundColor=[UIColor whiteColor]; self.cellBgView.backgroundColor=[UIColor whiteColor];
self.cellBgView.layer.masksToBounds=YES; self.cellBgView.layer.masksToBounds=YES;
self.cellBgView.layer.cornerRadius=4; self.cellBgView.layer.cornerRadius=4;
self.cellBgView.layer.borderColor=[UIColor colorWithHexString:@"#57BDEE"].CGColor; self.cellBgView.layer.borderColor=[UIColor colorWithHexString:@"#57BDEE"].CGColor;
self.cellBgView.layer.borderWidth=1; self.cellBgView.layer.borderWidth=1;
self.priceLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"]; self.priceLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"];
self.presentBeanLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"]; self.presentBeanLabel.textColor=[UIColor colorWithHexString:@"#57BDEE"];
} }
} }
@end @end
// //
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "FetchWalletTopUpDataModel.h" #import "ZX_recharge_item.h"
@interface TopupWalletCell : UITableViewCell @interface TopupWalletCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *collectionBgView; @property (weak, nonatomic) IBOutlet UIView *collectionBgView;
@property(nonatomic)NSMutableArray * topUpArray; @property(nonatomic)NSMutableArray * topUpArray;
@property(nonatomic,assign)CGFloat collectionViewHeigh; @property(nonatomic,assign)CGFloat collectionViewHeigh;
@property(nonatomic)void(^mySelectTopUpItem)(TopUpDataItem * item); @property(nonatomic, copy)void(^mySelectTopUpItem)(ZX_recharge_item * item);
@property(nonatomic)void(^mySelectFirstTopUpItem)(FirstTopUpDataItem * item);
-(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh; -(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh;
......
// //
...@@ -20,9 +20,6 @@ static CGFloat const margin = 11; ...@@ -20,9 +20,6 @@ static CGFloat const margin = 11;
@property (nonatomic, strong) UICollectionView *collectionView1; @property (nonatomic, strong) UICollectionView *collectionView1;
@property (nonatomic)NSMutableArray * topUpSelectArray;
@property (nonatomic)TopUpDataItem * selectTopUpItem;
@end @end
...@@ -31,7 +28,6 @@ static CGFloat const margin = 11; ...@@ -31,7 +28,6 @@ static CGFloat const margin = 11;
- (void)awakeFromNib { - (void)awakeFromNib {
[super awakeFromNib]; [super awakeFromNib];
self.topUpArray=[NSMutableArray array]; self.topUpArray=[NSMutableArray array];
self.topUpSelectArray =[NSMutableArray array];
[self creatCollectionView]; [self creatCollectionView];
// Initialization code // Initialization code
} }
...@@ -79,64 +75,22 @@ static CGFloat const margin = 11; ...@@ -79,64 +75,22 @@ static CGFloat const margin = 11;
id dataItem=self.topUpArray[indexPath.row]; id dataItem=self.topUpArray[indexPath.row];
cell.topUpDataItem=dataItem; cell.topUpDataItem=dataItem;
} }
if (indexPath.row<self.topUpSelectArray.count) {
[cell setUpUIWithString:self.topUpSelectArray[indexPath.row]];
}
return cell; return cell;
} }
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
[self.topUpSelectArray removeAllObjects]; id dataItem=self.topUpArray[indexPath.row];
if (self.mySelectTopUpItem) {
[self setUpSeletArrayWithSelectIndex:(int)indexPath.row]; self.mySelectTopUpItem(dataItem);
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);
}
} }
[self.collectionView1 reloadData];
} }
-(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh{ -(void)setUpWithArray:(NSMutableArray *)topUpArray CollectionViewHeigh:(CGFloat)collectionViewHeigh{
self.collectionViewHeigh=collectionViewHeigh; self.collectionViewHeigh=collectionViewHeigh;
self.topUpArray=topUpArray; self.topUpArray=topUpArray;
[self setUpSeletArrayWithSelectIndex:0];
//+2让切割一像素显示; //+2让切割一像素显示;
_collectionView1.frame=CGRectMake(12, 0,kWidth-24,self.collectionViewHeigh+2); _collectionView1.frame=CGRectMake(12, 0,kWidth-24,self.collectionViewHeigh+2);
[self.collectionView1 reloadData]; [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 @end
// //
...@@ -344,12 +344,14 @@ static NSInteger seq = 0; ...@@ -344,12 +344,14 @@ static NSInteger seq = 0;
[self.navigationController.navigationBar setHidden:YES]; [self.navigationController.navigationBar setHidden:YES];
[self.tabBarController.tabBar setHidden:NO]; [self.tabBarController.tabBar setHidden:NO];
if ([[kUserDefaults valueForKey:@"isUploadLog"] integerValue]) { if ([[kUserDefaults valueForKey:@"isUploadLog"] integerValue]) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{ NSArray *list = [ExpecptionModel findByCriteria:[NSString stringWithFormat:@"where uploadStatus <> 1"]];
NSArray *list = [ExpecptionModel findByCriteria:[NSString stringWithFormat:@"where uploadStatus <> 1"]]; if (list.count>10) {
if (list.count) { [ExpecptionModel clearTable];
} else {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self uploadExpectionWithList:list]; [self uploadExpectionWithList:list];
} });
}); }
} else { } else {
[ExpecptionModel clearTable]; [ExpecptionModel clearTable];
} }
...@@ -360,12 +362,9 @@ static NSInteger seq = 0; ...@@ -360,12 +362,9 @@ static NSInteger seq = 0;
#pragma mark - ========== 上传异常信息 ========== #pragma mark - ========== 上传异常信息 ==========
- (void) uploadExpectionWithList:(NSArray *) list { - (void) uploadExpectionWithList:(NSArray *) list {
if (list.count) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{ [self uploadItem:list.firstObject];
for (ExpecptionModel *exp in list) { }
[self uploadItem:exp];
}
});
} }
- (void) uploadItem:(ExpecptionModel *) exp { - (void) uploadItem:(ExpecptionModel *) exp {
......
// //
...@@ -34,13 +34,13 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool) ...@@ -34,13 +34,13 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool)
#pragma mark - ========== 开屏广告 ========== #pragma mark - ========== 开屏广告 ==========
-(void) createLauchAdByPlacmentId:(NSString *) placenmentId { -(void) createLauchAdByPlacmentId:(NSString *) placenmentId {
// if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
// GDTSplashAd *splash = [[GDTSplashAd alloc] initWithAppId:kTXAdAPPID placementId:placenmentId]; GDTSplashAd *splash = [[GDTSplashAd alloc] initWithAppId:kTXAdAPPID placementId:placenmentId];
// splash.delegate = self; splash.delegate = self;
// splash.fetchDelay = 3; splash.fetchDelay = 3;
// [splash loadAdAndShowInWindow:kAppWindow]; [splash loadAdAndShowInWindow:kAppWindow];
// self.splash = splash; self.splash = splash;
// } }
} }
- (void)splashAdApplicationWillEnterBackground:(GDTSplashAd *)splashAd - (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