123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980 |
- //
- // YOUPAILZHomeVC.m
- // MSYOUPAI
- //
- // Created by CY on 2022/2/28.
- // Copyright © 2022 MS. All rights reserved.
- //
- #import "YOUPAILZHomeVC.h"
- // controller
- #import "YOUPAILCUpdateVersionVC.h"
- #import "YOUPAILPYoungPwdVC.h"
- #import "YOUPAILPYoungForgetPWD.h"
- #import "YOUPAILZLiveAudienceVC.h"
- #import "YOUPAILZVipVC.h"
- #import "YOUPAIZYSearchVC.h"
- #import "YOUPAILZHomeActiveVC.h"
- #import "MSYMineinfoEditVC.h"
- //window
- #import "YOUPAILPYoungCloseWindow.h"
- #import "YOUPAILPYoungOpenWindow.h"
- #import "YOUPAILZSignWindow.h"
- #import "YOUPAIHRWebWindow.h"
- #import "YOUPAIZYAdvertWindow.h"
- #import "YOUPAIZYFirstRechargeWindow.h"
- #import "YOUPAILZExposureWindow.h"
- // category
- #import "UIViewController+TFPresent.h"
- // model
- #import "YOUPAILCFirstRechargeModel.h"
- #import "YOUPAILZHomeTVModel.h"
- // view
- #import "JXCategoryView.h"
- #import "SDCycleScrollView.h"
- #import "YOUPAILZGiftNoticeCell.h"
- #import "YOUPAILZInfoImperfectView.h"
- #import "YOUPAIFinishMsgWindow.h"
- #import "YOUPAILCWriteMesVC.h"
- @interface YOUPAILZHomeVC ()<LPYoungPwdDelegate,LPYoungCloseDelegate,LPYoungOpenDelegate,YoungModeResetDelegate,ZYFirstRechargeWindowDelegate,ZYAdvertWindowDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,SDCycleScrollViewDelegate,VQ_FinishMsgWindowDelegate>{
- dispatch_source_t _timer;
- }
- @property (nonatomic, weak) SDCycleScrollView *youpaipbannerView;
- @property (nonatomic, weak) UIView *youpaiptvBgV;
- @property (nonatomic, weak) UIButton *youpaipnoticeDescBtn; // 如何上电视按钮
- @property (nonatomic, strong) NSMutableArray <YOUPAILZHomeTVModel *> *youpaipTVDataSource; // 电视数据
- @property (nonatomic, weak) YOUPAILZInfoImperfectView *infoImperfectView;
- @property (nonatomic,strong)NSTimer *youpaipTVTimer;
- @property (nonatomic, assign)NSInteger currentTVLockTimer;
- @property (nonatomic, strong) NSString *youpaipTVUrl;
- @property(nonatomic,strong)SDCycleScrollView* youpaipSDCscrollView;
- @property (strong, nonatomic) YOUPAILCFirstRechargeModel *youpaipfirstRechargeModel;
- @end
- @implementation YOUPAILZHomeVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
-
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- [self youpaifDetectVersionUpdates];
- [self youpaifDetectYoungMode];
- [self youpaifloadFinishMsgStatus];
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
-
- [self.navigationController setNavigationBarHidden:NO animated:animated];
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.youpaipTVDataSource = [NSMutableArray array];
- [self youpaifinitConfig];
- [self youpaifloadLevelInfo];
- // [self youpaifrequestSignData];
- [self youpaifloadAdvert];
- [self youpaifrequestTVData];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifuserOnlineUpdate) name:@"youpaifuserOnlineUpdate" object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifTVDataUpdate:) name:@"VQUHomeTVDataNotification" object:nil];
-
- }
- //appid登录完善资料
- -(void)youpaifloadFinishMsgStatus{
-
- YOUPAILCUserModel *userModel = [LCSaveModel getUserModel];
- if (userModel.youpaipuserinfo.youpaipfinish_status == 0) {
- YOUPAIFinishMsgWindow *VC= [[YOUPAIFinishMsgWindow alloc]init];
- VC.vWidth = KScreenWidth - (47.5*2);
- VC.vHeight = 330;
- VC.youpaipfinishMsgdelegate = self;
- VC.isTouchDismiss = NO;
- [self TFPresentVC:VC completion:^{
- }];
- }
- }
- -(void)youpaifjumFinishMsgClick{
-
- YOUPAILCWriteMesVC *msg = [[YOUPAILCWriteMesVC alloc]init];
- msg.youpaipinviteCodeStr = [LCTools getPasteString];
- msg.isFinishMsg = YES;
- [self.navigationController pushViewController:msg animated:YES];
-
-
- }
- - (void)youpaifinitUI{
-
- UIView *youpaipnavV = [[UIView alloc] init];
- youpaipnavV.backgroundColor = [UIColor whiteColor];
- [self.view addSubview:youpaipnavV];
- [youpaipnavV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.right.offset(0.0f);
- make.height.offset(StatusBarHeight + 54.0f);
- }];
-
- // UIButton *youpaipsearchBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // [youpaipsearchBtn setImage:[UIImage imageNamed:@"vqu_images_home_search"] forState:UIControlStateNormal];
- // [youpaipsearchBtn addTarget:self action:@selector(youpaifsearchClick) forControlEvents:UIControlEventTouchUpInside];
- // [youpaipnavV addSubview:youpaipsearchBtn];
- // [youpaipsearchBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.offset(-11.0f);
- // make.bottom.offset(-13.5f);
- // make.size.mas_offset(CGSizeMake(25.0f, 25.0f));
- // }];
-
- UIButton *youpaipSuperExposureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipSuperExposureBtn setImage:[UIImage imageNamed:@"vqu_images_home_super_exposure"] forState:UIControlStateNormal];
- [youpaipSuperExposureBtn addTarget:self action:@selector(youpaifSuperExposureClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipnavV addSubview:youpaipSuperExposureBtn];
- [youpaipSuperExposureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.equalTo(youpaipsearchBtn.mas_left).offset(-8.5f);
- make.right.offset(-11.0f);
- make.bottom.offset(-16.0f);
- make.size.mas_offset(CGSizeMake(72.0f, 22.0f));
- }];
-
- JXCategoryTitleView *youpaipcategoryView = [[JXCategoryTitleView alloc] init];
- youpaipcategoryView.backgroundColor = [UIColor whiteColor];
- youpaipcategoryView.titles = self.titles;
- youpaipcategoryView.delegate = self;
- youpaipcategoryView.titleSelectedColor = LZ273145Color;
- youpaipcategoryView.titleColor = LZ475A7DColor;
- youpaipcategoryView.titleColorGradientEnabled = YES;
- youpaipcategoryView.titleFont = LCFont(18.0f);
- youpaipcategoryView.titleSelectedFont = LCBoldFont(18.0f);
- youpaipcategoryView.cellWidth = JXCategoryViewAutomaticDimension;
- youpaipcategoryView.cellSpacing = 20.0f;
- youpaipcategoryView.averageCellSpacingEnabled = NO;
- [youpaipnavV addSubview:youpaipcategoryView];
-
- JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
- lineView.verticalMargin = 10.0f;
- lineView.indicatorHeight = 3.0f;
- lineView.indicatorWidth = 10.0f;
- lineView.indicatorColor = LZ7C69FEColor;
- youpaipcategoryView.indicators = @[lineView];
-
-
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.listCellBackgroundColor = LZFAFAFCColor;
- [self.view addSubview:pagerView];
- youpaipcategoryView.listContainer = pagerView;
-
- [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.bottom.offset(0.0f);
- make.right.equalTo(youpaipSuperExposureBtn.mas_left).offset(-8.5f);
- make.height.offset(54.0f);
- }];
-
- UIView *youpaiptvBgV = [[UIView alloc] init];
- youpaiptvBgV.layer.cornerRadius = ScaleSize(10.0f);
- youpaiptvBgV.clipsToBounds = YES;
- youpaiptvBgV.backgroundColor = [HexColorFromRGB(0xB2BAF9) colorWithAlphaComponent:0.31f];
- [self.view addSubview:youpaiptvBgV];
- self.youpaiptvBgV = youpaiptvBgV;
- [youpaiptvBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(12.0f));
- make.right.offset(ScaleSize(-12.0f));
- make.top.offset(StatusBarHeight + 54.0f);
- make.height.offset(ScaleSize(0.0f));
- }];
-
- UIImageView *tvImgV = [[UIImageView alloc] init];
- tvImgV.image = [UIImage imageNamed:@"vqu_images_home_tv"];
- [youpaiptvBgV addSubview:tvImgV];
- [tvImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.offset(0.0f);
- make.width.offset(ScaleSize(72.0f));
- }];
-
- UIButton *youpaipnoticeDescBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipnoticeDescBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_h"] forState:UIControlStateNormal];
- [youpaipnoticeDescBtn setTitle:@"如何上电视" forState:UIControlStateNormal];
- [youpaipnoticeDescBtn setTitleColor:LZ7C69FEColor forState:UIControlStateNormal];
- youpaipnoticeDescBtn.titleLabel.font = LCFont(10.0f);
- youpaipnoticeDescBtn.layer.cornerRadius = 9.0f;
- youpaipnoticeDescBtn.clipsToBounds = YES;
- youpaipnoticeDescBtn.layer.borderColor = LZ7C69FEColor.CGColor;
- youpaipnoticeDescBtn.layer.borderWidth = 0.5f;
- [youpaipnoticeDescBtn addTarget:self action:@selector(youpaipnoticeDescBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipnoticeDescBtn setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
- [youpaiptvBgV addSubview:youpaipnoticeDescBtn];
- self.youpaipnoticeDescBtn = youpaipnoticeDescBtn;
- [youpaipnoticeDescBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(youpaiptvBgV);
- make.right.offset(-10.0f);
- make.size.mas_offset(CGSizeMake(70.0f, 18.0f));
- }];
- [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.bottom.offset(-TabbarHeight);
- make.top.equalTo(youpaiptvBgV.mas_bottom).offset(9.0f);
- }];
-
-
- SDCycleScrollView *youpaipbannerView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:nil];
- youpaipbannerView.autoScrollTimeInterval = 3.0;//2s轮播
- // youpaipbannerView.imageURLStringsGroup = @[@"",@""];
- youpaipbannerView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
- youpaipbannerView.backgroundColor = [UIColor clearColor];
- youpaipbannerView.scrollDirection = UICollectionViewScrollDirectionVertical;
- youpaipbannerView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
- youpaipbannerView.mainView.userInteractionEnabled = NO;
- [youpaiptvBgV addSubview:youpaipbannerView];
- self.youpaipbannerView = youpaipbannerView;
- [youpaipbannerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.bottom.offset(0.0f);
- make.left.equalTo(tvImgV.mas_right).offset(0.0f);
- make.right.equalTo(youpaipnoticeDescBtn.mas_left).offset(0.0f);
- }];
- @weakify(self);
- [youpaipbannerView setItemDidScrollOperationBlock:^(NSInteger currentIndex) {
- @strongify(self);
- NSInteger lock_time = [self.youpaipTVDataSource[currentIndex].youpaiplock_time integerValue];
- if (lock_time != 0) {
- self.currentTVLockTimer = lock_time;
- self.youpaipTVDataSource[currentIndex].youpaiplock_time = @"0";
- [self youpaifstartTimer];
- }else{
- [self youpaifstopTimer];
- }
- if (lock_time == 0) {
- lock_time = 3;
- }
- self.youpaipbannerView.autoScrollTimeInterval = lock_time;
- }];
- [self loadRightSDCView];
- [self youpaifinitInfoImperfectView];
- }
- - (void)youpaipnoticeDescBtnClick{
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = self.youpaipTVUrl;
- [self.navigationController pushViewController:vc animated:YES];
- }
- -(void)loadRightSDCView{
-
-
- SDCycleScrollView *rightBannerView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(KScreenWidth - 12.0f - 49.0f, KScreenHeight - TabbarHeight - 12.0f-39-19-50, 50, 50.0f) delegate:self placeholderImage:[UIImage imageNamed:@""]];
- self.youpaipSDCscrollView = rightBannerView;
-
- rightBannerView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
- rightBannerView.autoScrollTimeInterval = 3.0;//2s轮播
- rightBannerView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
- rightBannerView.backgroundColor = [UIColor clearColor];
- [self.view addSubview:rightBannerView];
- [self youpaifloadFirstRecharge];
- }
- -(void)youpaifloadFirstRecharge{
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@"2"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipfirstRechargeModel = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
-
- NSMutableArray *imgUrlArray = [NSMutableArray new];
- for (YOUPAILCBannerModel* model in self.youpaipfirstRechargeModel.youpaiplist) {
- [imgUrlArray addObject:[LCTools getImageUrlWithAddress:model.youpaipimage]];
- }
-
- self.youpaipSDCscrollView.imageURLStringsGroup = imgUrlArray;
- if (self.youpaipfirstRechargeModel.youpaipis_open == 1) {
- self.youpaipSDCscrollView.hidden = NO;
-
- }else{
- self.youpaipSDCscrollView.hidden = YES;
-
- }
- }
- } failure:^(NSError *error) {}];
-
- }
- #pragma mark - SDCycleScrollViewDelegate
- - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
- {
- YOUPAILCBannerModel* model = self.youpaipfirstRechargeModel.youpaiplist[index];
- if (model.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = model.youpaiplink_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (model.youpaiplink_type==2||model.youpaiplink_type==3){
- [self youpaifpageToStr:model.youpaiplink_url];
- }
- }
- // 开始计时
- - (void)youpaifstartTimer{
- if (self.youpaipTVTimer == nil) {
- self.youpaipTVTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(youpaiftimerAction) userInfo:nil repeats:YES];
- [[NSRunLoop currentRunLoop] addTimer:self.youpaipTVTimer forMode:NSRunLoopCommonModes];
- }
- [self.youpaipnoticeDescBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_n"] forState:UIControlStateNormal];
- [self.youpaipnoticeDescBtn setTitle:[NSString stringWithFormat:@"锁屏中%@s",@(self.currentTVLockTimer)] forState:UIControlStateNormal];
- [self.youpaipnoticeDescBtn setTitleColor:LZA3AABEColor forState:UIControlStateNormal];
- self.youpaipnoticeDescBtn.layer.borderColor = LZA3AABEColor.CGColor;
- }
- // 结束计时
- - (void)youpaifstopTimer{
- [self.youpaipTVTimer invalidate];
- self.youpaipTVTimer = nil;
-
- [self.youpaipnoticeDescBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_h"] forState:UIControlStateNormal];
- [self.youpaipnoticeDescBtn setTitle:@"如何上电视" forState:UIControlStateNormal];
- self.youpaipnoticeDescBtn.layer.borderColor = LZ7C69FEColor.CGColor;
- [self.youpaipnoticeDescBtn setTitleColor:LZ7C69FEColor forState:UIControlStateNormal];
- }
- - (void)youpaiftimerAction{
- self.currentTVLockTimer --;
-
- [self.youpaipnoticeDescBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_n"] forState:UIControlStateNormal];
- [self.youpaipnoticeDescBtn setTitle:[NSString stringWithFormat:@"锁屏中%@s",@(self.currentTVLockTimer)] forState:UIControlStateNormal];
- [self.youpaipnoticeDescBtn setTitleColor:LZA3AABEColor forState:UIControlStateNormal];
- if (self.currentTVLockTimer < 0) {
- [self youpaifstopTimer];
- }
- }
- - (void)youpaifinitInfoImperfectView{
- if ([LCSaveData getWhiteVersion]) {
- return;
- }
- YOUPAILZInfoImperfectView *infoImperfectView = [[YOUPAILZInfoImperfectView alloc] initWithFrame:CGRectMake(12, KScreenHeight, KScreenWidth - 24.0f, 39.0f)];
- @weakify(self);
- [infoImperfectView setGoEditUserInfoPageBlock:^{
- @strongify(self);
- MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
- [self.navigationController pushViewController:editvc animated:true];
- }];
- [self.view addSubview:infoImperfectView];
- self.infoImperfectView = infoImperfectView;
- }
- /** 如果你需要自定义cell样式,请在实现此代理方法返回你的自定义cell的class。 */
- - (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view{
- if (view == self.youpaipbannerView) {
- return YOUPAILZGiftNoticeCell.class;
- }
- return nil;
- }
- /** 如果你自定义了cell样式,请在实现此代理方法为你的cell填充数据以及其它一系列设置 */
- - (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view{
- YOUPAILZGiftNoticeCell *itemCell = (YOUPAILZGiftNoticeCell *)cell;
- [itemCell youpaifreloadWithModel:self.youpaipTVDataSource[index]];
- }
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
- return self.titles.count;
- }
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- YOUPAILZHomeActiveVC *vc = [[YOUPAILZHomeActiveVC alloc] init];
- vc.youpaiprequestUrl = self.urls[index];
- @weakify(self);
- [vc setShowUserInfoImperfectBlock:^(BOOL isShow) {
- @strongify(self);
- if (isShow) {
- [UIView animateWithDuration:0.25f animations:^{
- self.infoImperfectView.mj_y = KScreenHeight - TabbarHeight - 12.0f - self.infoImperfectView.mj_h;
- }];
- }
- }];
- return vc;
- }
- - (NSArray <NSString *> *)titles{
- return @[@"推荐",@"在线"];
- }
- - (NSArray<NSString *> *)urls{
- return @[HomeRecommend,HomeOnlineList];
- }
- /// 搜索
- - (void)youpaifsearchClick{
- YOUPAIZYSearchVC* seach = [[YOUPAIZYSearchVC alloc]init];
- [self pushEffectPresentToVC:seach];
- }
- /// 超级曝光
- - (void)youpaifSuperExposureClick{
- YOUPAILZExposureWindow *window = [[YOUPAILZExposureWindow alloc] init];
- @weakify(self);
- [window setGoVipPageBlock:^{
- @strongify(self);
- YOUPAILZVipVC* vc = [[YOUPAILZVipVC alloc]init];
- [self.navigationController pushViewController:vc animated:YES];
- }];
- [self TFPresentVC:window completion:nil];
- }
- /// 获取上电视数据
- - (void)youpaifrequestTVData{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetOntvList parameters:@{} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipTVDataSource = [YOUPAILZHomeTVModel mj_objectArrayWithKeyValuesArray:[dict objectForKey:@"data"]];
- NSMutableArray *arr = [NSMutableArray array];
- for (YOUPAILZHomeTVModel *model in self.youpaipTVDataSource) {
- [arr addObject:@""];
- }
- if (arr.count != 0) {
- self.youpaiptvBgV.hidden = NO;
- [self.youpaiptvBgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(12.0f));
- make.right.offset(ScaleSize(-12.0f));
- make.top.offset(StatusBarHeight + 54.0f + ScaleSize(9.0f));
- make.height.offset(ScaleSize(60.0f));
- }];
- }
- self.youpaipbannerView.imageURLStringsGroup = arr;
- }
- } failure:^(NSError *error) {
- }];
- }
- - (void)youpaifTVDataUpdate:(NSNotification *)notify{
- NSDictionary *dataDic = notify.userInfo;
- YOUPAILZHomeTVModel *notifyModel = dataDic[@"model"];
- if (self.youpaipbannerView.currentIndex + 1 >= self.youpaipTVDataSource.count - 1) {
- [self.youpaipTVDataSource addObject:notifyModel];
- }else{
- [self.youpaipTVDataSource insertObject:notifyModel atIndex:self.youpaipbannerView.currentIndex + 1];
- }
- NSMutableArray *arr = [NSMutableArray array];
- for (YOUPAILZHomeTVModel *model in self.youpaipTVDataSource) {
- [arr addObject:@""];
- }
- self.youpaipbannerView.imageURLStringsGroup = arr;
- [self.youpaipbannerView makeScrollViewScrollToIndex:self.youpaipbannerView.currentIndex];
- }
- #pragma mark-广告弹框
- -(void)youpaifloadAdvert{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"source_id":@"2"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSInteger status = [dict[@"data"][@"advert"][@"status"] integerValue];
- NSString *image = dict[@"data"][@"advert"][@"image"];
- NSInteger link_type = [dict[@"data"][@"advert"][@"link_type"] integerValue];
- NSString *link_url = dict[@"data"][@"advert"][@"link_url"];
- NSInteger window_type = [dict[@"data"][@"advert"][@"window_type"] integerValue];
- if (status == 1 && image.length>5) {
- if (window_type == 2) {
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = dict[@"data"][@"advert"][@"window_link"];
- window.youpaipwidth = [dict[@"data"][@"advert"][@"width"] floatValue];
- window.youpaipheight = [dict[@"data"][@"advert"][@"height"] floatValue];
- window.youpaipgravity = dict[@"data"][@"advert"][@"gravity"];
- [self TFPresentVC:window completion:^{}];
- }else{
- YOUPAIZYAdvertWindow *VC= [[YOUPAIZYAdvertWindow alloc]init];
- VC.youpaipdelegate = self;
- VC.vWidth = KScreenWidth -30;
- VC.vHeight = KScreenWidth-30;
- VC.youpaipimageurl = image;
- VC.youpaiplink_type = link_type;
- VC.youpaiplink_url = link_url;
- VC.isTouchDismiss = YES;
- [self TFPresentVC:VC completion:^{}];
- }
- }
-
- }
- } failure:^(NSError *error) {}];
- }
- //获取首冲弹框数据
- -(void)youpaifloadAdvert1{
- if ([NSStringFromClass([LCTools getContainNavigationControllerCurrentVC].class) isEqual:@"YOUPAILZChatRoomVC"]) {
- return;
- }
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@"6"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- YOUPAILCFirstRechargeModel *firstRechargeModel1 = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
- for (int i = 0; i<firstRechargeModel1.youpaiplist.count; i++) {
- YOUPAILCBannerModel* model = firstRechargeModel1.youpaiplist[i];
- if (model.youpaipdelayed_time == 0) {
- [self youpaifshowAdvertAlertWithModel:model];
- }else{
- [self performSelector:@selector(youpaifshowAdvertAlertWithModel:) withObject:model afterDelay:model.youpaipdelayed_time];
- }
- }
- }
- } failure:^(NSError *error) {}];
- }
- - (void)youpaifshowAdvertAlertWithModel:(YOUPAILCBannerModel *)model{
- if([NSStringFromClass([LCTools getCurrentVC].class) isEqual:@"YOUPAILZLiveAnchorVC"]) {
- return;
- }
- if([LCTools getContainNavigationControllerCurrentVC].tabBarController == nil) {
- return;
- }
-
- if (model.youpaipwindow_type == 2) {
- YOUPAIHRWebWindow *window = [[YOUPAIHRWebWindow alloc] init];
- window.isTouchDismiss = YES;
- window.youpaipurl = model.youpaipwindow_link;
- window.youpaipwidth = model.youpaipwidth;
- window.youpaipheight = model.youpaipheight;
- window.youpaipgravity = model.youpaipgravity;
- [[LCTools getCurrentVC] TFPresentVC:window completion:^{}];
- }else{
- YOUPAIZYFirstRechargeWindow *VC= [[YOUPAIZYFirstRechargeWindow alloc]init];
- VC.youpaipdelegate = self;
- VC.vWidth = KScreenWidth -30;
- VC.vHeight = KScreenWidth-30;
- VC.youpaipimageurl = model.youpaipimage;
- VC.youpaiplink_type = model.youpaiplink_type;
- VC.youpaiplink_url = model.youpaiplink_url;
- VC.isTouchDismiss = YES;
- [[LCTools getCurrentVC] TFPresentVC:VC completion:^{}];
- }
- }
- #pragma mark - ZYFirstRechargeWindowDelegate
- - (void)youpaifLZFirstRechargeClickAdverImage:(NSInteger)link_type andUrl:(NSString *)link_url{
- if (link_type == 1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = link_url;
- UIViewController *vc = [LCTools getContainNavigationControllerCurrentVC];
- if([NSStringFromClass([LCTools getContainNavigationControllerCurrentVC].class) isEqual:@"YOUPAILZLiveAudienceVC"]) {
- YOUPAILZLiveAudienceVC *audienceVC = (YOUPAILZLiveAudienceVC *)vc;
- audienceVC.youpaipisNotPanClose = YES;
- }
- [vc.navigationController pushViewController:baseWeb animated:YES];
- }else if (link_type==2 || link_type==3){
- UIViewController *vc = [LCTools getContainNavigationControllerCurrentVC];
- if([NSStringFromClass([LCTools getContainNavigationControllerCurrentVC].class) isEqual:@"YOUPAILZLiveAudienceVC"]) {
- YOUPAILZLiveAudienceVC *audienceVC = (YOUPAILZLiveAudienceVC *)vc;
- audienceVC.youpaipisNotPanClose = YES;
- }
- [vc youpaifpageToStr:link_url];
- }else{
-
-
- }
-
- }
- #pragma mark -ZYAdvertWindowDelegate
- -(void)youpaifclickAdverImage:(NSInteger)link_type andUrl:(NSString *)link_url
- {
- if (link_type == 1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = link_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (link_type==2 || link_type==3){
- [self youpaifpageToStr:link_url];
- }else{
- YOUPAILZVipVC* baseWeb = [[YOUPAILZVipVC alloc]init];
- [self.navigationController pushViewController:baseWeb animated:YES];
-
- }
- }
- /// 系统配置信息
- - (void)youpaifinitConfig{
- [[SDWebImageDownloader sharedDownloader] downloadImageWithURL:[LCTools getImageUrlWithAddress:@"/v1.3/dress/bubble/lALPD3zUOqg7eJA7bg_110_59.png"] options:SDWebImageDownloaderUseNSURLCache progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
- if(data != nil){
- [LCSaveData saveBubbleWithKey:[LCTools getImageUrlWithAddress:@"/v1.3/dress/bubble/lALPD3zUOqg7eJA7bg_110_59.png"].absoluteString Data:data];
- }
- }];
- @weakify(self);
- [LCHttpHelper requestWithURLString:AppConfig parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- // self.youpaipswitch_index = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"switch_index"] integerValue];
- NSString* sysId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"sysId"];
- NSString* servId = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"servId"];
- NSString* appurl = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"appurl"];
- NSArray* serviceIdArr = [[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"serviceId"];
- NSString *audit_status = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"audit_status"]];
- NSString *rankH5Url = [[dict objectForKey:@"data"]objectForKey:@"rank_url"];
- NSInteger free = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"free"] integerValue];
- // NSInteger timeOut = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"timeOut"] integerValue];
- NSInteger isLive = [[[[dict objectForKey:@"data"]objectForKey:@"config"] objectForKey:@"is_live"] integerValue];
- self.youpaipTVUrl = [[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"tv"];
- if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipfinish_status != 0) {
- [self youpaifloadAdvert1];
- }
- [LCSaveData saveAppUrl:appurl];
- [LCSaveData saveSysId:sysId];
- [LCSaveData saveServerId:servId];
- [LCSaveData saveServiceIdArr:serviceIdArr];
- [LCSaveData saveRankH5Url:rankH5Url];
- [LCSaveData saveIMPrice:free];
- [LCSaveData saveIsLive:isLive];
-
- NSArray *bubbles = [[[dict objectForKey:@"data"]objectForKey:@"dress"] objectForKey:@"bubble"];
-
- for (NSDictionary *bubbleDist in bubbles) {
- [[SDWebImageDownloader sharedDownloader] downloadImageWithURL:[LCTools getImageUrlWithAddress:[bubbleDist objectForKey:@"bubble"]] options:SDWebImageDownloaderUseNSURLCache progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
- if(data != nil){
- [LCSaveData saveBubbleWithKey:[LCTools getImageUrlWithAddress:[bubbleDist objectForKey:@"bubble"]].absoluteString Data:data];
- }
- }];
- }
-
- BOOL onlineStatus = NO;
- if (audit_status.length != 0) {
- onlineStatus = ![audit_status boolValue];
- }
-
- if (onlineStatus != [LCSaveData getOnlineVersion]) {
- [LCSaveData saveOnlineVersion:onlineStatus];
- /// 线上版本状态改变,发送通知
- [[NSNotificationCenter defaultCenter] postNotificationName:@"OnlineVersion" object:nil userInfo:nil];
- }
- [self youpaifinitUI];
-
- }
- } failure:^(NSError *error) {
-
- }];
- }
- #pragma mark 版本更新
- /// 检测版本更新
- - (void)youpaifDetectVersionUpdates{
- //检查更新 根据时间戳 设定12小时/一天之内调用一次 add by leo
- NSString* updateTime = [LCSaveData getUpdateTime];
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- if (!updateTime) {
- [self youpaifcheckAppUpdate:NO];//检查版本更新
- }else{
- //获取与当前的时间差
- NSDate *timeDate = [dateFormatter dateFromString:updateTime];
- NSTimeInterval timeInterval = [timeDate timeIntervalSinceNow];
- timeInterval = -timeInterval;
- //超过30天
- if (timeInterval>60*60*24) {
- [self youpaifcheckAppUpdate:NO];
- }else{
- }
- }
- }
- /// 获取等级图标
- - (void)youpaifloadLevelInfo{
- [LCHttpHelper requestWithURLString:LevelInfo parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSDictionary* levelInfo = [dict objectForKey:@"data"];
-
- [LCSaveData saveLevelInfo:levelInfo];
-
- }
- } failure:^(NSError *error) {
-
- }];
-
- [LCHttpHelper requestWithURLString:AllBadge parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSDictionary* data = [dict objectForKey:@"data"];
- NSDictionary* badge = [data objectForKey:@"badge"];
- NSDictionary* noble = [data objectForKey:@"noble"];
-
- [LCSaveData saveBadgeInfo:badge];
- [LCSaveData saveNobleInfo:noble];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- /// 获取签到数据
- - (void)youpaifrequestSignData{
- @weakify(self);
- [LCHttpHelper requestWithURLString:UserSign parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
-
- NSString *msg = [[dict objectForKey:@"data"] objectForKey:@"msg"];
- NSString *beans = [[dict objectForKey:@"data"] objectForKey:@"beans"];
- NSString *link = [[dict objectForKey:@"data"] objectForKey:@"link"];
-
- YOUPAILZSignWindow *vc = [[YOUPAILZSignWindow alloc]init];
- vc.youpaipmsg = msg;
- vc.youpaipbeans = beans;
- vc.youpaiplink = link;
- vc.isTouchDismiss = YES;
- [vc setGoSignBlock:^(NSString * _Nonnull signUrl) {
- @strongify(self);
- ZCBaseWebVC* vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = signUrl;
- [self.navigationController pushViewController:vc animated:YES];
- }];
- [self TFPresentVC:vc completion:^{
- }];
-
- }
- } failure:^(NSError *error) {}];
-
- }
- /// 更新在线状态
- -(void)youpaifuserOnlineUpdate{
- NSLog(@"youpaifuserOnlineUpdate 更新在线状态");
-
- if (self->_timer) {
- dispatch_source_cancel(self->_timer);
- }
- if ([LCSaveData getTokenString] == nil) {
- return;
- }
- [LCHttpHelper requestWithURLString:onlineUpdate parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSInteger user_online_open = [[[dict objectForKey:@"data"]objectForKey:@"user_online_open"] integerValue];
- int user_online_time = [[[dict objectForKey:@"data"]objectForKey:@"user_online_time"] intValue];
- if (user_online_open == 1) {
- __block int timeout= user_online_time;
- dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- self->_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);
- dispatch_source_set_timer(self->_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
- dispatch_source_set_event_handler(self->_timer, ^{
- if(timeout<=0){
- dispatch_source_cancel(self->_timer);
- dispatch_async(dispatch_get_main_queue(), ^{
- [self youpaifuserOnlineUpdate];
- });
- }else{
- NSString *strTime = [NSString stringWithFormat:@"%.2dS",timeout];
- dispatch_async(dispatch_get_main_queue(), ^{
- //设置界面的按钮显示 根据自己需求设置
- // NSLog(@"strTime strTime %@",strTime);
- //
- // NSLog(@"当前时间挫%lld",[[LCTools getCurrentTimestamp] longLongValue]);
- });
- timeout--;
- }});
- dispatch_resume(self->_timer);
- }
- }
- } failure:^(NSError *error) {}];
- }
- //add bu leo checkVersion 检查版本更新
- -(void)youpaifcheckAppUpdate:(BOOL)need
- {
- [LCHttpHelper requestWithURLString:CheckUpdateVersion parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary *dict = (NSDictionary *)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0){
- NSString *newVersion = [[dict objectForKey:@"data"] objectForKey:@"newversion"];
- // NSString *myVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
-
- NSString *app_build = [[UIApplication sharedApplication] appVersion];
- if ([newVersion compare:app_build options:NSCaseInsensitiveSearch]>0) {
-
- YOUPAILCUpdateVersionVC *VC= [[YOUPAILCUpdateVersionVC alloc]init];
- VC.youpaipenforce = [[[dict objectForKey:@"data"] objectForKey:@"enforce"]integerValue];
- VC.youpaipdownLoadUrl = [[dict objectForKey:@"data"] objectForKey:@"downloadurl"];
- VC.youpaipversionStr = [NSString stringWithFormat:@"版本号:%@",newVersion];
- VC.youpaipupdateText = [[dict objectForKey:@"data"] objectForKey:@"upgradetext"];
- VC.vWidth = KScreenWidth - 70;
- NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:14]};
- CGSize maxSize= [VC.youpaipupdateText boundingRectWithSize:CGSizeMake(VC.vWidth-116,66) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
- if(maxSize.height<28)
- {
- maxSize.height = 28;
- }else{
- maxSize.height = maxSize.height+20;
- }
- VC.vHeight = VC.vWidth*203/305.0 +86 + maxSize.height + 120;
- VC.isTouchDismiss = YES;
- if(VC.youpaipenforce == NO)
- [self TFPresentVC:VC completion:^{
- NSDate *newData = [NSDate date];
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSString *dataString = [dateFormatter stringFromDate:newData];
- [LCSaveData saveUpdateTime:dataString];
- }];
- else{
- VC.isTouchDismiss = NO;
- [self TFPresentVC:VC completion:^{
-
- }];
- }
-
- }else{
- NSLog(@"dict === %@,%d",dict,need);
- if (need) {
- [ZCHUDHelper showTitle:@"已经是最新版本"];
- }
-
- }
-
- }
-
- NSLog(@"dict === %@,%d",dict,need);
-
-
- } failure:^(NSError *error) {
-
- }];
-
- }
- #pragma mark 青少年模式
- /// 检测青少年模式
- - (void)youpaifDetectYoungMode{
- //青少年模式
- //先判断是否设置了青少年模式
- kAppDelegate.kadolescentStatus = [LCSaveData getYoungMode];
- if(kAppDelegate.kadolescentStatus == 1){
- [self youpaifshowYoungCloseWindow];
- }else{
- //在判断是否提醒过
- //检查更新 根据时间戳 设定12小时/一天之内调用一次
- NSString* updateTime = [LCSaveData getYoungNoticeTime];
- NSDate * newData = [NSDate date];
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- if (!updateTime) {
- NSString* dataString = [dateFormatter stringFromDate:newData];
- [LCSaveData saveYoungNoticeTime:dataString];
- //弹出设置青少年模式弹窗
- //要不要检查一下status 防止卸载后重装
- @weakify(self);
- [self youpaifAdenscentStatus:^{
- @strongify(self);
- [self youpaifshowYoungCloseWindow];
- } closed:^{
- @strongify(self);
- [self youpaifshowYongNoticeWindow];
- }];
- }else{
- //获取与当前的时间差
- NSDate *timeDate = [dateFormatter dateFromString:updateTime];
- NSTimeInterval timeInterval = [timeDate timeIntervalSinceNow];
- timeInterval = -timeInterval;
- //超过30天
- if (timeInterval>60*60*24) {
- NSString* dataString = [dateFormatter stringFromDate:newData];
- [LCSaveData saveYoungNoticeTime:dataString];
- //弹出青少年模式弹窗
- [self youpaifshowYongNoticeWindow];
- }else{
- }
- }
- }
- }
- //显示设置青少年模式通知
- -(void)youpaifshowYongNoticeWindow
- {
- YOUPAILPYoungOpenWindow *VC= [[YOUPAILPYoungOpenWindow alloc]init];
- VC.vWidth = 313.0f;
- VC.vHeight = 357.0f;
- VC.youpaipdelegate = self;
- VC.isTouchDismiss = YES;
- [self TFPresentVC:VC completion:^{
- }];
- }
- -(void)youpaifshowYoungCloseWindow
- {
- YOUPAILPYoungCloseWindow *VC= [[YOUPAILPYoungCloseWindow alloc]init];
- VC.vWidth = 313.0f;
- VC.vHeight = 357.0f;
- VC.youpaipdelegate = self;
- VC.isTouchDismiss = NO;
- [self TFPresentVC:VC completion:^{
- }];
-
- }
- //判断青少年模式状态
- -(void)youpaifAdenscentStatus:(void(^)(void))openBlock closed:(void(^)(void))closeBlock{
- [LCHttpHelper requestWithURLString:GetAdolescentStatus parameters:nil needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSInteger adoleStatus=[dict[@"data"][@"is_set_adolescent"] integerValue];
- if(adoleStatus==1)
- {
- openBlock();
- }
- else
- {
- closeBlock();
- }
- }
- else
- {
-
- }
-
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.mj_JSONString showtime:1];
- [self dismissViewControllerAnimated:YES completion:nil];
- }];
- }
- #pragma mark LPYoungOpenDelegate 提示或者关闭弹框的回调
- -(void)youpaifyoungSettingPwd{//设置未成年模式的密码
- YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
- vc.youpaipdelegate = self;
- vc.youpaippwdStatus = TFPWDSETTING;
- [self.navigationController pushViewController:vc animated:YES];
- }
- //忘记密码
- -(void)youpaifyoungForgetPwd{
- YOUPAILPYoungForgetPWD *vc = [[YOUPAILPYoungForgetPWD alloc]init];
- vc.youpaipdelegate = self;
- [self.navigationController pushViewController:vc animated:YES];
- //关闭或打开 发通知 或者回调
- /*
- YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
- vc.pwdStatus = TFPWDCLOSE;
- [self.navigationController pushViewController:vc animated:YES];
- */
-
- }
- -(void)youpaifyoungClose{
- YOUPAILPYoungPwdVC *vc = [[YOUPAILPYoungPwdVC alloc]init];
- vc.youpaippwdStatus = TFPWDCLOSE;
- vc.youpaipdelegate = self;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark 密码输入确认回调
- -(void)youpaifswitchYounModel:(NSInteger)isopen{
- if(isopen){
- [self youpaifshowYoungCloseWindow];
- [LCSaveData saveYoungMode:YES];
- kAppDelegate.kadolescentStatus =1;
- }else{
- [LCSaveData saveYoungMode:NO];
- kAppDelegate.kadolescentStatus = 0;
- }
- }
- @end
|