diff --git a/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 74854be..ed9a9b4 100644 --- a/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,22 +2,4 @@ - - - - - - diff --git a/GIGA/AppDelegate.m b/GIGA/AppDelegate.m index 180fe85..8ab176b 100644 --- a/GIGA/AppDelegate.m +++ b/GIGA/AppDelegate.m @@ -51,8 +51,24 @@ [GiGaBaseAPiRequest userTokenTimeOutGologinFromVC:self.window.rootViewController]; } }]; + + }else{ + + // 未登录同步默认面膜时间 + GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:kUserDefaultMaskTime method:RequestPostMethod parms:nil]; + [api requstDataWithResult:^(GiGaAPIResult *result) { + if (result.success) { + + float minute = [result.dic[@"minute"] floatValue]; + if (minute !=0) { + + [GiGaUserDefault savaMaskeTime:minute*60]; + } + } + }]; } + //用户关闭后台权限 提醒开启 if ([[UIApplication sharedApplication] backgroundRefreshStatus] != UIBackgroundRefreshStatusAvailable ) { [self.window.rootViewController jxt_showAlertWithTitle:@"温馨提示" message:@"为保证您正常使用面膜时间,需要您开启后台刷新,请在 设置->面膜时间->应用程序后台刷新 开启" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { alertMaker.addActionCancelTitle(@"下次"); @@ -128,9 +144,9 @@ // [[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"闹钟提醒!" fireTimeInterval:2 alertAction:@"面膜时间已添加闹钟提醒!" withIdentifier:kLOCALNotifiID_APPTERMINAL]; //进程结束 长期保持后台前提下 用户主动挂起 取消本地推送。 - [[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification]; + // [[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification]; } - //[[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification]; + [[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification]; } -(void)remoteControlReceivedWithEvent:(UIEvent *)event diff --git a/GIGA/Assets.xcassets/maskTime/img_product.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/img_product.imageset/Contents.json new file mode 100644 index 0000000..d92fa5e --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/img_product.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "img_product@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/img_product.imageset/img_product@2x.png b/GIGA/Assets.xcassets/maskTime/img_product.imageset/img_product@2x.png new file mode 100644 index 0000000..3886c61 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/img_product.imageset/img_product@2x.png differ diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m index 4882030..0dbd1d8 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m @@ -18,7 +18,7 @@ NSString *const kGiGaToken = @"GiGatoken"; NSString *const kMaskeTime= @"userMaskeTime"; NSString *const kWeiXinCodeInfo = @"WeiXinCodeinfo"; NSString *const kShowUserTested = @"kShowUserTested"; -#define MASKTIME_DEFAULT 20; +#define MASKTIME_DEFAULT 17.5; @implementation GiGaUserDefault @@ -145,13 +145,12 @@ NSString *const kShowUserTested = @"kShowUserTested"; NSTimeInterval time = [UD_STADARDUD doubleForKey:kMaskeTime]; if (time == 0) { - //默认17.5 分钟 + //默认17.5 分钟 已改调用接口同步默认 time = 17.5 * 60; //time = MASKTIME_DEFAULT; } - //time = 5; + //time = 10; return time; - } +(void)saveUserTestFlag:(BOOL)tested{ diff --git a/GIGA/Common/GiGaUserDB/GiGaUserManager.m b/GIGA/Common/GiGaUserDB/GiGaUserManager.m index 82861e3..e529835 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserManager.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserManager.m @@ -69,7 +69,7 @@ const static NSInteger GIGADB_USER_VER = 0;//当前数据库版本号 }else{ if (errorCodeMsg) { - errorCodeMsg(requst.resultDict); + errorCodeMsg(result.dic); } } diff --git a/GIGA/Config/ApiRequestConfig.h b/GIGA/Config/ApiRequestConfig.h index 3637c5b..052234e 100644 --- a/GIGA/Config/ApiRequestConfig.h +++ b/GIGA/Config/ApiRequestConfig.h @@ -73,5 +73,8 @@ //正式 #define kIMPRITNT @"http://app.mianmoshijian.com/imprint.html?device=ios" +//获取默认面膜时间 +#define kUserDefaultMaskTime @"activity/maskuselog/v1/minute" + #endif /* ApiRequestConfig_h */ diff --git a/GIGA/Config/GiGaServerConfig.m b/GIGA/Config/GiGaServerConfig.m index 8cabb0c..a801557 100644 --- a/GIGA/Config/GiGaServerConfig.m +++ b/GIGA/Config/GiGaServerConfig.m @@ -19,13 +19,14 @@ case 0://测试环境 { - [[NSUserDefaults standardUserDefaults] setValue:@"http://apiyts.s1.natapp.cc/v1/" forKey:@"MainUrl"]; - [[NSUserDefaults standardUserDefaults] setValue:@"http://wsyts.s1.natapp.cc" forKey:@"gigasocketUrl"]; -// [[NSUserDefaults standardUserDefaults] setValue:@"https://api.mianmoshijian.com/v1/" forKey:@"MainUrl"]; -// [[NSUserDefaults standardUserDefaults] setValue:@"https://ws.mianmoshijian.com" forKey:@"gigasocketUrl"]; -// +// [[NSUserDefaults standardUserDefaults] setValue:@"http://apiyts.s1.natapp.cc/v1/" forKey:@"MainUrl"]; +// [[NSUserDefaults standardUserDefaults] setValue:@"http://wsyts.s1.natapp.cc" forKey:@"gigasocketUrl"]; + [[NSUserDefaults standardUserDefaults] setValue:@"https://api.mianmoshijian.com/v1/" forKey:@"MainUrl"]; + [[NSUserDefaults standardUserDefaults] setValue:@"https://ws.mianmoshijian.com" forKey:@"gigasocketUrl"]; + } break; + case 1: //生产环境 { //https://api.mianmoshijian.com/v1/ @@ -34,7 +35,6 @@ } break; - default: break; } diff --git a/GIGA/Info.plist b/GIGA/Info.plist index c39d2e1..480e072 100644 --- a/GIGA/Info.plist +++ b/GIGA/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 1.6.3 + 1.6.5 LSApplicationQueriesSchemes weixin diff --git a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m index 1283c25..86cf8b2 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m +++ b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m @@ -192,6 +192,9 @@ // NSDictionary *weixinInfoDic = [GiGaUserDefault getWeiXinAccessToenDic]; NSString *wechatCode = [GiGaUserDefault getWeiXinCode]; + if (wechatCode==nil) { + wechatCode = @""; + } NSDictionary *params = nil; params = @{ @"mobile":self.acountTextField.text, @@ -313,44 +316,43 @@ if ([responseDict[@"code"] integerValue] == 0) { [self userloginSussecess:responseDict]; - }else if([responseDict[@"code"] integerValue] == 500){ - //登录流程待定 - //[self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; - [self jxt_showAlertWithTitle:@"温馨提示" message:responseDict[@"msg"] appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { - alertMaker.addActionCancelTitle(@"知道了"); - } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { - }]; - }else{ [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; } }else{ + [self.view makeToast:@"用户信息提交异常"]; GILog(@"上传微信用户信息error:\n%@",error.localizedDescription); } }]; } - +//请求用户数据 -(void)userloginSussecess:(NSDictionary *)resDic{ - //token 登陆标志 [GiGaUserDefault saveToken:resDic[@"token"]]; - //埋点 - [MobClick endEvent:MobClick_UserLogin]; - GIGA_WIndowTost(@"登录成功!"); - //请求用户数据 - + weakify(self); [[GiGaUserManager shareUser] synsisUserInfo:^(GiGaUser *user) { + GILog(@"user.userId:%@",user.userId); + + //埋点 + [MobClick endEvent:MobClick_UserLogin]; + GIGA_WIndowTost(@"登录成功!"); NC_POST_NAME_OBJECT(kUserLoginSuccessNoti, nil); + [weakSelf dismissViewControllerAnimated:YES completion:nil]; + } userErrorMsgBlock:^(NSDictionary *errorCodemsg) { + if (errorCodemsg) { + NSString *msg = errorCodemsg[@"msg"]; + if (msg) { + GIGA_ShowToast(msg); + } + } }]; - [self dismissViewControllerAnimated:YES completion:nil]; - } //接收注册成功通知 diff --git a/GIGA/Modules/Mask/Controller/GIGaMaskShareViewController.m b/GIGA/Modules/Mask/Controller/GIGaMaskShareViewController.m index b2845a8..7c69d57 100644 --- a/GIGA/Modules/Mask/Controller/GIGaMaskShareViewController.m +++ b/GIGA/Modules/Mask/Controller/GIGaMaskShareViewController.m @@ -108,7 +108,9 @@ cell.minuteLab.text = [NSString stringWithFormat:@"%@min",self.model.minute]; cell.timeLable.text = [NSString stringWithFormat:@"这是您敷面膜的第:%@张",self.model.monthMaskNum]; if (self.model.productImgUrl && ![self.model.productImgUrl isKindOfClass:[NSNull class]]) { - [cell.holdImagView sd_setImageWithURL:[NSURL URLWithString:self.model.productImgUrl]]; + //[cell.holdImagView sd_setImageWithURL:[NSURL URLWithString:self.model.productImgUrl]]; + [cell.holdImagView sd_setImageWithURL:[NSURL URLWithString:self.model.productImgUrl] placeholderImage:[UIImage imageNamed:@"img_product"]]; + } } diff --git a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m index 5614367..cc4ac0a 100644 --- a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m +++ b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m @@ -257,7 +257,7 @@ [self setUpNav]; [self initUI]; [self addNotify]; - //[self creatBackGroundMusic]; + [self creatBackGroundMusic]; [self creatMaskTimeSatrtMusic]; } @@ -266,7 +266,7 @@ -(void)maskupSwipeGesture{ [self animaMask]; } -#pragma mark 点击手势结束面膜时间 +#pragma mark 点击手势面膜时间 -(void)maskTapAction{ [self animaMask]; } @@ -284,18 +284,17 @@ } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { if (buttonIndex == 1) { [self.cicleProgressView stop]; + //手动结束时结束peding通知 + [[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification]; [self maskTimeEnd]; } }]; } - - #pragma mark - 开始面膜时间动画 合并 -(void)animaMask{ - self.swipeGaurdimagView.hidden = YES; self.startMaskButton.hidden = YES; [self.view layoutIfNeeded]; @@ -506,7 +505,7 @@ } delegate.isMasking = YES; [_startMaskMusic play]; - //[_musicPalyer play]; + [_musicPalyer play]; // [self setBackGroundPlayingInfo];//锁屏音频信息 //总时间隔 s @@ -568,13 +567,12 @@ //面膜时间结束时设置 全局变量 不再发送本地通知 提醒 AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate]; delegate.isMasking = NO; - //[_musicPalyer stop]; + [_musicPalyer stop]; //震动 需用户手动开启震动模式 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); //复原动画 [self endMaskAnimation]; - } #pragma mark 开始测试 @@ -744,8 +742,11 @@ -(void)refreshUserIcon:(NSString *)imageUrl{ NSURL *url = [NSURL URLWithString:imageUrl]; - [self.rightNavUserBtn sd_setImageWithURL:url forState:UIControlStateNormal]; - + // [self.rightNavUserBtn sd_setImageWithURL:url forState:UIControlStateNormal]; + + [self.rightNavUserBtn sd_setImageWithURL:url forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"nav_circle_avatar"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + + }]; } #pragma mark 消息 action @@ -870,8 +871,10 @@ BOOL isUserLogin = [GiGaUserDefault isUserLogin]; if (isUserLogin) { + NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime]; - NSString *minute = [NSString stringWithFormat:@"%.f",timeInterVal /60]; + NSString *minute = [NSString stringWithFormat:@"%.1f",timeInterVal / 60]; + GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:KApiBeginMaskTime method:RequestPostMethod parms:@{@"minute":minute}]; [api requstDataWithResult:^(GiGaAPIResult *result) { if (result.success) { diff --git a/GIGA/Modules/Mask/Controller/ShareViewController.m b/GIGA/Modules/Mask/Controller/ShareViewController.m index 736985d..ccc8d08 100644 --- a/GIGA/Modules/Mask/Controller/ShareViewController.m +++ b/GIGA/Modules/Mask/Controller/ShareViewController.m @@ -141,8 +141,7 @@ } } return cell; - } - else if (indexPath.row == 2){ + }else if (indexPath.row == 2){ MaskShareBoootomViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskShareBoootomViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskShareBoootomViewCell" owner:self options:nil] lastObject]; @@ -403,7 +402,9 @@ } } + return _viewControllers; + } @end diff --git a/GIGA/Modules/Mask/View/MaskTimeEndViewImgaeCell.xib b/GIGA/Modules/Mask/View/MaskTimeEndViewImgaeCell.xib index 7320a25..fb1440d 100644 --- a/GIGA/Modules/Mask/View/MaskTimeEndViewImgaeCell.xib +++ b/GIGA/Modules/Mask/View/MaskTimeEndViewImgaeCell.xib @@ -25,7 +25,7 @@ - + @@ -107,7 +107,7 @@ - + diff --git a/GIGA/Modules/Me/Controller/GiMaskTimeHistoryVC.m b/GIGA/Modules/Me/Controller/GiMaskTimeHistoryVC.m index 8dceebc..d73ff9d 100644 --- a/GIGA/Modules/Me/Controller/GiMaskTimeHistoryVC.m +++ b/GIGA/Modules/Me/Controller/GiMaskTimeHistoryVC.m @@ -18,8 +18,8 @@ @interface GiMaskTimeHistoryVC () @property(nonatomic,strong) NSMutableArray *dataArr; -@property(nonatomic) NSUInteger currentPage; -@property(nonatomic,assign) NSInteger totalMinute; +@property(nonatomic) int currentPage; +@property(nonatomic,copy) NSString *totalMinute; @property(nonatomic,assign) NSInteger ranking; @property(nonatomic,assign) NSUInteger totalPage; //@property(nonatomic,strong) MaskHistryRecordlist *record; @@ -35,7 +35,7 @@ [super viewDidLoad]; self.dataArr = [[NSMutableArray alloc] init]; _currentPage = 1; - _totalMinute = 0; + _totalMinute = @"0.0"; _ranking = 0; _isFreshing = NO; [self addNavTitile:@"历史记录"]; @@ -53,7 +53,7 @@ self.tableView.rowHeight = UITableViewAutomaticDimension; [self creatRefreshView]; - [self loadDataWtih:[NSString stringWithFormat:@"%ld",_currentPage] isFresh:YES]; + [self loadDataWtih:[NSString stringWithFormat:@"%d",_currentPage] isFresh:YES]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ @@ -84,7 +84,7 @@ } - cell.timeLabe.text = [NSString stringWithFormat:@"%ld",(long)self.totalMinute]; + cell.timeLabe.text = [NSString stringWithFormat:@"%@",self.totalMinute]; if (self.exquisitePercent) { NSString *text = [NSString stringWithFormat:@"本月超过%@用户",self.exquisitePercent]; @@ -111,7 +111,6 @@ return cell; } - - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section == 0) { return 1; @@ -154,7 +153,7 @@ NSDictionary *reDic =result.dic; self.ranking = [[reDic valueForKey:@"ranking"] integerValue]; - self.totalMinute = [[reDic valueForKey:@"totalMinute"] integerValue] ; + self.totalMinute = [reDic valueForKey:@"totalMinute"]; self.exquisitePercent = [reDic valueForKey:@"exquisitePercent"]; self.guizeUrl = [reDic valueForKey:@"ruleUrl"]; @@ -220,10 +219,9 @@ return; } - if (_currentPage < _totalPage) { _currentPage ++; - [self loadDataWtih:[NSString stringWithFormat:@"%ld",self.currentPage] isFresh:NO]; + [self loadDataWtih:[NSString stringWithFormat:@"%d",self.currentPage] isFresh:NO]; } } diff --git a/GIGA/Modules/Me/Model/GiGaUser.h b/GIGA/Modules/Me/Model/GiGaUser.h index 7e010e5..07996de 100644 --- a/GIGA/Modules/Me/Model/GiGaUser.h +++ b/GIGA/Modules/Me/Model/GiGaUser.h @@ -31,6 +31,7 @@ @property(nonatomic,assign) int sexCode; @property(nonatomic,copy) NSString *sexName; @property(nonatomic,copy) NSString *weixin; -@property(nonatomic) int minute; + +@property(nonatomic) float minute; @end