123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928 |
- //
- // YMMineViewModel.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/4.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMMineViewModel.h"
- #import "YMFeesSettingViewModel.h"
- #import "YMSettingViewModel.h"
- #import "YMMineInfoModel.h"
- #import "YMWealthModel.h"
- #import "YMWealthModel.h"
- #import "LPBeautySetVC.h"
- #import "YOUPAILCIMSessionVC.h"
- #import "YMGreetingSettingViewModel.h"
- #import "MSYMineinfoEditVC.h"
- #import "YOUPAILZUserShowVC.h"
- #import "YOUPAILZProfitVC.h"
- @interface YMMineViewModel ()
- /// 0未加入公会 1已加入公会 2已加入公会会长
- @property (nonatomic, assign, readwrite) NSInteger userGuild;
- /// 用户头像
- @property (nonatomic, copy, readwrite) NSString *userAvatar;
- /// 用户昵称
- @property (nonatomic, copy, readwrite) NSString *userNickname;
- /// 用户性别
- @property (nonatomic, assign, readwrite) NSInteger userGender;
- /// 用户代码
- @property (nonatomic, copy, readwrite) NSString *userCode;
- /// 用户简介
- @property (nonatomic, copy, readwrite) NSString *userIntro;
- /// 用户余额
- @property (nonatomic, copy, readwrite) NSString *userBalance;
- /// 用户收益
- @property (nonatomic, copy, readwrite) NSString *userEarnings;
- /// 违规公布链接
- @property (nonatomic, copy, readwrite) NSString *offenseNoticeUrl;
- /// 在线客服链接
- @property (nonatomic, copy, readwrite) NSString *onlineServiceUrl;
- /// 邀请链接
- @property (nonatomic, copy, readwrite) NSString *inviteUrl;
- /// 任务中心链接
- @property (nonatomic, copy, readwrite) NSString *taskCenterUrl;
- /// 用户等级
- @property (nonatomic, copy, readwrite) NSString *userGrade;
- /// 是否完整信息 1展示 0隐藏
- @property (nonatomic, assign, readwrite) BOOL isCompleteInfo;
- /// 是否女神认证
- @property (nonatomic, assign, readwrite) BOOL isGoddessCertified;
- /// 是否VIP
- @property (nonatomic, assign, readwrite) BOOL isVIP;
- /// 开通会员提示
- @property (nonatomic, copy, readwrite) NSString *openMembershipTips;
- /// 数量信息字典数据
- @property (nonatomic, strong, readwrite) NSArray <NSDictionary *> *quantityInfoDicDataArray;
- /// 数量信息模组数据
- @property (nonatomic, strong, readwrite) NSArray <YMMineQuantityInfoViewModel *> *quantityInfoGridDataArray;
- /// 常用功能一字典数据
- @property (nonatomic, strong, readwrite) NSArray <NSDictionary *> *commonFunctionsOneDicDataArray;
- /// 常用功能一模组数据
- @property (nonatomic, strong, readwrite) NSArray <YMMineCommonFunctionsViewModel *> *commonFunctionsOneGridDataArray;
- /// 常用功能二字典数据
- @property (nonatomic, strong, readwrite) NSArray <NSDictionary *> *commonFunctionsTwoDicDataArray;
- /// 常用功能二模组数据
- @property (nonatomic, strong, readwrite) NSArray <NSDictionary *> *commonFunctionsTwoListDataArray;
- /// 常用功能三字典数据
- @property (nonatomic, strong, readwrite) NSArray <NSDictionary *> *commonFunctionsThreeDicDataArray;
- /// 常用功能三模组数据
- @property (nonatomic, strong, readwrite) NSArray <YMMineCommonFunctionsViewModel *> *commonFunctionsThreeGridDataArray;
- /// 数字信息操作
- @property (nonatomic, strong, readwrite) RACSubject *quantityInfoOperationSubject;
- /// 常用功能操作
- @property (nonatomic, strong, readwrite) RACSubject *commonFunctionsOperationSubject;
- /// 用户Id
- @property (nonatomic, assign) NSInteger userId;
- @end
- @implementation YMMineViewModel
- - (void)ym_initialize{
- [super ym_initialize];
-
- @weakify(self)
- [[self.quantityInfoOperationSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable value) {
- // @strongify(self)
- switch ([value intValue]) {
- case YMMineQuantityInfoTypeFollow:
- {
- YMFriendsViewModel *friendsVM = [[YMFriendsViewModel alloc]initWithParams:@{
- ParamsDefaultIndex:@(0)
- }];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_FRIENDS) withUserInfo:@{
- RouterViewModel:friendsVM,
- } completion:nil];
- }
- break;
- case YMMineQuantityInfoTypeFans:
- {
- YMFriendsViewModel *friendsVM = [[YMFriendsViewModel alloc]initWithParams:@{
- ParamsDefaultIndex:@(1)
- }];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_FRIENDS) withUserInfo:@{
- RouterViewModel:friendsVM,
- } completion:nil];
- }
- break;
- case YMMineQuantityInfoTypeSpoor:
- {
- YMSpoorViewModel *spoorVM = [[YMSpoorViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_SPOOR) withUserInfo:@{
- RouterViewModel:spoorVM
- } completion:nil];
- }
- break;
- case YMMineQuantityInfoTypeReceivedLikes:
- {
- YMReceivedLikesViewModel *receivedLikesVM = [[YMReceivedLikesViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_RECEIVED_LIKES) withUserInfo:@{
- RouterViewModel:receivedLikesVM
- } completion:nil];
- }
- break;
- case YMMineQuantityInfoTypeGuest:
- {
- YMGuestViewModel *guestVM = [[YMGuestViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_GUEST) withUserInfo:@{
- RouterViewModel:guestVM
- } completion:nil];
- }
- break;
- default:
- break;
- }
- }];
-
- [[self.commonFunctionsOperationSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable value) {
- @strongify(self)
- switch ([value intValue]) {
- case YMCommonFunctionsTypeInvitingPrizes:
- {
-
- YMInvitingPrizesViewModel *invitingPrizesVM = [[YMInvitingPrizesViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_INVITING_PRIZES) withUserInfo:@{
- RouterViewModel:invitingPrizesVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeRealPersonAccreditation:
- {
- YMGoddessCertifiedProtocolViewModel *goddessCertifiedProtocolVM = [[YMGoddessCertifiedProtocolViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_GODDESS_CERTIFIED_PROTOCOL) withUserInfo:@{
- RouterViewModel:goddessCertifiedProtocolVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeRankingList:
- {
- YMRankingViewModel *rankingVM = [[YMRankingViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_RANKING) withUserInfo:@{
- RouterViewModel:rankingVM
- } completion:nil];
-
- }
- break;
- case YMCommonFunctionsTypeBeautySetting:
- {
- LPBeautySetVC *beautySet = [[LPBeautySetVC alloc]init];
- [[YMGlobalUtils getCurrentVC].navigationController pushViewController:beautySet animated:YES];
- }
- break;
- case YMCommonFunctionsTypeChatPrice:
- {
- if ([self isNeedGoddessCertified]) {
- return;
- }
- YMFeesSettingViewModel *feesSettingVM = [[YMFeesSettingViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_FEES_SETTING) withUserInfo:@{
- RouterViewModel:feesSettingVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeMyBill:
- {
- YMIncomeBreakdownViewModel *incomeBreakdownVM = [[YMIncomeBreakdownViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_INCOME_BREAKDOWN) withUserInfo:@{
- RouterViewModel:incomeBreakdownVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeVideoDoNotDisturb:
- {
- if ([self isNeedGoddessCertified]) {
- return;
- }
- [self videoDoNotDisturbStatus];
- }
- break;
- case YMCommonFunctionsTypePrivateLetterChat:
- {
- [self privateLetterChatStatus];
- }
- break;
- case YMCommonFunctionsTypePrivateLetterSound:
- {
- [self privateLetterSoundStatus];
- }
- break;
- case YMCommonFunctionsTypePersonalPage:
- {
- YMPersonalPageViewModel *personalPageVM = [[YMPersonalPageViewModel alloc]initWithParams:@{
- ParamsId:@(self.userId)
- }];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_PERSONAL_PAGE) withUserInfo:@{
- RouterViewModel:personalPageVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeOnlineCustomerSupport:
- {
- // YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
- // ParamsUrl:[YMGlobalUtils shared].helpUrl
- // }];
- // [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
- // RouterViewModel:webArticleVM
- // } completion:nil];
- // ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- // vc.contentUrl = [YMGlobalUtils shared].helpUrl;
- // [[YMGlobalUtils getCurrentVC].navigationController pushViewController:vc animated:YES];
- // 在线客服
- NIMSession *session = [NIMSession session:[LCSaveData getServerId] type:NIMSessionTypeP2P];
- if (session) {
- @weakify(self);
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- // @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:vc animated:YES];
- }];
- }
-
- }
- break;
- case YMCommonFunctionsTypePlatformStrategy:
- {
- // YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
- // ParamsUrl:[YMGlobalUtils shared].helpUrl
- // }];
- // [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
- // RouterViewModel:webArticleVM
- // } completion:nil];
- // ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- // vc.contentUrl = [YMGlobalUtils shared].helpUrl;
- // [[YMGlobalUtils getCurrentVC].navigationController pushViewController:vc animated:YES];
-
- NIMSession *session = [NIMSession session:[LCSaveData getCooperationId] type:NIMSessionTypeP2P];
- if (session) {
- @weakify(self);
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- // @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:vc animated:YES];
- }];
- }
-
- }
- break;
- case YMCommonFunctionsTypeSystemSetting:
- {
- YMSettingViewModel *settingVM = [[YMSettingViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_SETTING) withUserInfo:@{
- RouterViewModel:settingVM
- } completion:nil];
- }
- break;
- case YMCommonFunctionsTypeSayHello:
- {
- if ([self isNeedGoddessCertified]) {
- return;
- }
- YMGreetingSettingViewModel *greetingSettingVM = [[YMGreetingSettingViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_GREETING_SETTING) withUserInfo:@{
- RouterViewModel:greetingSettingVM
- } completion:nil];
- }
- break;
-
- case YMCommonFunctionsTypeGuildManagement:
- {
- YMGuildManagementViewModel *guildManagementVM = [[YMGuildManagementViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_GUILD_MANAGEMENT) withUserInfo:@{
- RouterViewModel:guildManagementVM
- } completion:nil];
- }
- break;
- default:
- break;
- }
- }];
-
- self.quantityInfoDicDataArray = @[
- @{
- @"title":@"0",
- @"desc":@"关注",
- ParamsCategoryType:@(YMMineQuantityInfoTypeFollow),
- },
- @{
- @"title":@"0",
- @"desc":@"粉丝",
- ParamsCategoryType:@(YMMineQuantityInfoTypeFans),
- },
- @{
- @"title":@"0",
- @"desc":@"足迹",
- ParamsCategoryType:@(YMMineQuantityInfoTypeSpoor),
- },
- @{
- @"title":@"0",
- @"desc":@"点赞",
- ParamsCategoryType:@(YMMineQuantityInfoTypeReceivedLikes),
- },
- @{
- @"title":@"0",
- @"desc":@"访客",
- ParamsCategoryType:@(YMMineQuantityInfoTypeGuest),
- },
- ];
-
- self.commonFunctionsOneDicDataArray = @[
- @{
- @"icon":@"ym_mine_invited_icon",
- @"title":@"邀请有奖",
- ParamsCategoryType:@(YMCommonFunctionsTypeInvitingPrizes),
- },
- @{
- @"icon":@"ym_mine_real_person_accreditation_icon",
- @"title":@"真人认证",
- ParamsCategoryType:@(YMCommonFunctionsTypeRealPersonAccreditation),
- },
- @{
- @"icon":@"ym_mine_beauty_setting_icon",
- @"title":@"美颜设置",
- ParamsCategoryType:@(YMCommonFunctionsTypeBeautySetting),
- },
- @{
- @"icon":@"ym_mine_chat_price_icon",
- @"title":@"聊天价格",
- ParamsCategoryType:@(YMCommonFunctionsTypeChatPrice),
- },
- @{
- @"icon":@"ym_mine_chat_say_hello",
- @"title":@"打招呼",
- ParamsCategoryType:@(YMCommonFunctionsTypeSayHello),
- },
- @{
- @"icon":@"ym_mine_guild_management_icon",
- @"title":@"公会管理",
- ParamsCategoryType:@(YMCommonFunctionsTypeGuildManagement),
- },
- @{
- @"icon":@"ym_mine_online_customer_support_icon",
- @"title":@"在线客服",
- ParamsCategoryType:@(YMCommonFunctionsTypeOnlineCustomerSupport),
- },
- @{
- @"icon":@"ym_mine_platform_strategy_icon",
- @"title":@"合作洽谈",
- ParamsCategoryType:@(YMCommonFunctionsTypePlatformStrategy),
- },
-
- ];
-
- self.commonFunctionsTwoDicDataArray = @[
- @{
- @"icon":@"ym_mine_video_do_not_disturb_icon",
- @"title":@"视频开关",
- ParamsCategoryType:@(YMCommonFunctionsTypeVideoDoNotDisturb),
- },
- @{
- @"icon":@"ym_mine_private_letter_chat_icon",
- @"title":@"私信聊天",
- ParamsCategoryType:@(YMCommonFunctionsTypePrivateLetterChat),
- },
- @{
- @"icon":@"ym_mine_private_letter_sound_icon",
- @"title":@"私信音效",
- ParamsCategoryType:@(YMCommonFunctionsTypePrivateLetterSound),
- },
- ];
-
- self.commonFunctionsThreeDicDataArray = @[
- @{
- @"icon":@"ym_mine_personal_page_icon",
- @"title":@"个人主页",
- ParamsCategoryType:@(YMCommonFunctionsTypePersonalPage),
- },
- @{
- @"icon":@"ym_mine_online_customer_support_icon",
- @"title":@"在线客服",
- ParamsCategoryType:@(YMCommonFunctionsTypeOnlineCustomerSupport),
- },
- @{
- @"icon":@"ym_mine_platform_strategy_icon",
- @"title":@"合作洽谈",
- ParamsCategoryType:@(YMCommonFunctionsTypePlatformStrategy),
- },
- @{
- @"icon":@"ym_mine_system_setting_icon",
- @"title":@"系统设置",
- ParamsCategoryType:@(YMCommonFunctionsTypeSystemSetting),
- },
- @{
- @"icon":@"ym_mine_guild_management_icon",
- @"title":@"公会管理",
- ParamsCategoryType:@(YMCommonFunctionsTypeGuildManagement),
- },
- ];
-
- }
- - (void)getMineInfoData{
- @weakify(self)
- [LCHttpHelper requestWithURLString:UserCenter parameters:nil needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- @strongify(self)
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
-
- YMMineInfoModel *model = [YMMineInfoModel yy_modelWithJSON:[dict dictionaryValueForKey:@"data" defaultValue:@{}]];
-
- self.userGuild = model.guild;
- self.userAvatar = model.userinfo.avatar;
- self.userNickname = model.userinfo.nickname;
- self.userGender = model.userinfo.gender;
- self.userCode = model.userinfo.usercode;
- self.userId = model.userinfo.user_id;
- self.userIntro = model.userinfo.sign;
-
- if (model.anchor.open_video_status == 0) {
- [LCSaveData saveVideoOpenStatu:NO];
- }else{
- [LCSaveData saveVideoOpenStatu:YES];
- }
- if (model.anchor.order_switch == 1) {
- [LCSaveData saveOrderOpenStatu:YES];
- }else{
- [LCSaveData saveOrderOpenStatu:NO];
- }
-
- if (model.userinfo.is_msg_refuse == 0) {
- [LCSaveData saveProfileWuraoStatus:YES];
- }else{
- [LCSaveData saveProfileWuraoStatus:NO];
-
- }
-
- self.offenseNoticeUrl = model.webUrl.publish;
-
- self.onlineServiceUrl = model.webUrl.share;
-
- self.inviteUrl = model.webUrl.help;
-
- self.taskCenterUrl = model.webUrl.taskCenter;
-
- self.userGrade = model.webUrl.myGrade;
-
- self.isCompleteInfo = model.is_complete_info;
-
- self.isGoddessCertified = model.userinfo.is_anchor == 0 ? NO : YES;
-
- self.isVIP = model.userinfo.vip == 0 ? NO : YES;
-
- self.openMembershipTips = model.userinfo.vip == 0 ? @"查看开通会员10大权益" : model.userinfo.vip_des;
-
- [OCUserDefaults setBool:model.userinfo.gender == 1 ? YES : NO forKey:kIS_FEMALE_GENDER];
- [OCUserDefaults setBool:model.userinfo.is_anchor == 1 ? YES : NO forKey:kIS_GODDESS_CERTIFIED];
- [OCUserDefaults setBool:model.userinfo.vip == 0 ? NO : YES forKey:kIS_VIP];
-
- if (!OCStringIsEmpty(model.webUrl.tv)) {
- [OCUserDefaults setObject:model.webUrl.tv forKey:kON_TV_WEB_URL];
- }
-
- if (!OCStringIsEmpty(model.webUrl.anchorStarlevel)) {
- [OCUserDefaults setObject:model.webUrl.anchorStarlevel forKey:kINCREASE_STAR_RATING_URL];
- }
-
- if (!OCStringIsEmpty(model.webUrl.help)) {
- [OCUserDefaults setObject:model.webUrl.anchorStarlevel forKey:kHELP_URL];
- }
-
- if (!OCStringIsEmpty(model.webUrl.recharge_agreement)) {
- [OCUserDefaults setObject:model.webUrl.recharge_agreement forKey:kRECHARGE_AGREEMENT_URL];
- }
-
- if (!OCStringIsEmpty(model.webUrl.juvenile_protection)) {
- [OCUserDefaults setObject:model.webUrl.juvenile_protection forKey:kMINOR_PROTECTION_PROGRAM_URL];
- }
-
- [OCUserDefaults synchronize];
-
- NSArray *quantityInfoGridDataArr = [[self.quantityInfoDicDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable quantityInfoDic) {
- YMMineQuantityInfoType type = [quantityInfoDic integerValueForKey:ParamsCategoryType defaultValue:YMMineQuantityInfoTypeFollow];
- /*
- 判断女神认证显示的功能
- if (self.isGoddessCertified && type == YMMineQuantityInfoTypeReceivedLikes) {
- return YES;
- } else if (!self.isGoddessCertified && type == YMMineQuantityInfoTypeReceivedLikes) {
- return NO;
- }else if (!self.isGoddessCertified && type == YMMineQuantityInfoTypeSpoor) {
- return YES;
- } else if (self.isGoddessCertified && type == YMMineQuantityInfoTypeSpoor) {
- return NO;
- }else {
- return YES;
- }
- */
- if (type == YMMineQuantityInfoTypeReceivedLikes) {
- return NO;
- } else {
- return YES;
- }
-
- }] map:^(NSDictionary * _Nullable quantityInfoDic) {
- YMMineQuantityInfoType type = [quantityInfoDic integerValueForKey:ParamsCategoryType defaultValue:YMMineQuantityInfoTypeFollow];
- YMMineQuantityInfoViewModel *viewModel = [[YMMineQuantityInfoViewModel alloc]init];
- viewModel.titleString = [quantityInfoDic stringValueForKey:@"title" defaultValue:@"0"];
- viewModel.desc = [quantityInfoDic stringValueForKey:@"desc" defaultValue:@""];
- viewModel.infoType = type;
- switch (type) {
- case YMMineQuantityInfoTypeFollow:
- {
- if (model.usercount.follow_count > 0) {
- viewModel.titleString = stringFormat(@"%ld",model.usercount.follow_count);
- }
- }
- break;
- case YMMineQuantityInfoTypeFans:
- {
- if (model.usercount.fans_count > 0) {
- viewModel.titleString = stringFormat(@"%ld",model.usercount.fans_count);
- }
- if (model.usercount.new_fans_count > 0) {
- viewModel.badge = model.usercount.new_fans_count > 99 ? @"99+" : stringFormat(@"%ld",model.usercount.new_fans_count);
- }
- }
- break;
- case YMMineQuantityInfoTypeSpoor:
- {
- if (model.usercount.viewer_count > 0) {
- viewModel.titleString = stringFormat(@"%ld",model.usercount.viewer_count);
- }
- }
- break;
- case YMMineQuantityInfoTypeReceivedLikes:
- {
- if (model.usercount.videoTrendsLike_count > 0) {
- viewModel.titleString = stringFormat(@"%ld",model.usercount.videoTrendsLike_count);
- }
- if (model.usercount.new_videoTrendsLike_count > 0) {
- viewModel.badge = model.usercount.new_videoTrendsLike_count > 99 ? @"99+" : stringFormat(@"%ld",model.usercount.new_videoTrendsLike_count);
- }
- }
- break;
- case YMMineQuantityInfoTypeGuest:
- {
- if (model.usercount.visitor_count > 0) {
- viewModel.titleString = stringFormat(@"%ld",model.usercount.visitor_count);
- }
- if (model.usercount.new_visitor_count > 0) {
- viewModel.badge = model.usercount.new_visitor_count > 99 ? @"99+" : stringFormat(@"%ld",model.usercount.new_visitor_count);
- }
- }
- break;
- default:
- break;
- }
- return viewModel;
- }].array;
- if (quantityInfoGridDataArr && quantityInfoGridDataArr.count > 0) {
- self.quantityInfoGridDataArray = quantityInfoGridDataArr;
- } else {
- self.quantityInfoGridDataArray = @[];
- }
-
- NSArray *commonFunctionsOneGridDataArr = [[self.commonFunctionsOneDicDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable commonFunctionsOneDic) {
- YMCommonFunctionsType type = [commonFunctionsOneDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypeInvitingPrizes];
- // 是否是女性
- if (self.userGender == 1) {
- // 是否女神认证
- if (!self.isGoddessCertified && type == YMCommonFunctionsTypeRealPersonAccreditation) {
- return YES;
- }else if (self.isGoddessCertified && type == YMCommonFunctionsTypeRealPersonAccreditation) {
- return NO;
- }else if(self.userGuild != 2 && type == YMCommonFunctionsTypeGuildManagement){
- return NO;
- }else if(self.userGuild == 2 && type == YMCommonFunctionsTypeGuildManagement){
- return YES;
- }else{
- return YES;
- }
- }else{
- if (type == YMCommonFunctionsTypeRealPersonAccreditation || type == YMCommonFunctionsTypeChatPrice
- || type == YMCommonFunctionsTypeSayHello) {
- return NO;
- }else if(self.userGuild != 2 && type == YMCommonFunctionsTypeGuildManagement){
- return NO;
- }else if(self.userGuild == 2 && type == YMCommonFunctionsTypeGuildManagement){
- return YES;
- }else{
- return YES;
- }
- }
-
- }] map:^(NSDictionary * _Nullable commonFunctionsOneDic) {
- YMCommonFunctionsType type = [commonFunctionsOneDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypeInvitingPrizes];
- YMMineCommonFunctionsViewModel *viewModel = [[YMMineCommonFunctionsViewModel alloc]init];
- viewModel.imageName = [commonFunctionsOneDic stringValueForKey:@"icon" defaultValue:@""];
- viewModel.titleString = [commonFunctionsOneDic stringValueForKey:@"title" defaultValue:@""];
- viewModel.functionsType = type;
- return viewModel;
- }].array;
- if (commonFunctionsOneGridDataArr && commonFunctionsOneGridDataArr.count > 0) {
- self.commonFunctionsOneGridDataArray = commonFunctionsOneGridDataArr;
- } else {
- self.commonFunctionsOneGridDataArray = @[];
- }
-
- NSArray *commonFunctionsTwoListDataArr = [[self.commonFunctionsTwoDicDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable commonFunctionsTwoDic) {
- return YES;
- // YMCommonFunctionsType type = [commonFunctionsTwoDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- // 是否是女性
- // if (self.userGender != 1) {
- // if (type == YMCommonFunctionsTypeVideoDoNotDisturb) {
- // return NO;
- // } else {
- // return YES;
- // }
- // }else{
- // return YES;
- // }
- }] map:^(NSDictionary * _Nullable commonFunctionsTwoDic) {
- NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithDictionary:commonFunctionsTwoDic];
- YMCommonFunctionsType type = [dataDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- switch (type) {
- case YMCommonFunctionsTypeVideoDoNotDisturb:
- [dataDic setObject:@(model.anchor.open_video_status == 1 ? YES : NO) forKey:@"isOpen"];
- break;
- case YMCommonFunctionsTypePrivateLetterChat:
- [dataDic setObject:@(model.userinfo.is_msg_refuse == 0 ? YES : NO) forKey:@"isOpen"];
- break;
- case YMCommonFunctionsTypePrivateLetterSound:
- [dataDic setObject:@([LCSaveData getIMMsgVoice] ? YES : NO) forKey:@"isOpen"];
- break;
- default:
- break;
- }
- return dataDic;
- }].array;
- if (commonFunctionsTwoListDataArr && commonFunctionsTwoListDataArr.count > 0) {
- self.commonFunctionsTwoListDataArray = commonFunctionsTwoListDataArr;
- } else {
- self.commonFunctionsTwoListDataArray = @[];
- }
-
- NSArray *commonFunctionsThreeGridDataArr = [self.commonFunctionsThreeDicDataArray.rac_sequence map:^(NSDictionary * _Nullable commonFunctionsThreeDic) {
- YMCommonFunctionsType type = [commonFunctionsThreeDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePersonalPage];
- YMMineCommonFunctionsViewModel *viewModel = [[YMMineCommonFunctionsViewModel alloc]init];
- viewModel.imageName = [commonFunctionsThreeDic stringValueForKey:@"icon" defaultValue:@""];
- viewModel.titleString = [commonFunctionsThreeDic stringValueForKey:@"title" defaultValue:@""];
- viewModel.functionsType = type;
- return viewModel;
- }].array;
- if (commonFunctionsThreeGridDataArr && commonFunctionsThreeGridDataArr.count > 0) {
- self.commonFunctionsThreeGridDataArray = commonFunctionsThreeGridDataArr;
- } else {
- self.commonFunctionsThreeGridDataArray = @[];
- }
-
- [self.refreshUISubject sendNext:@(YMRefreshUI)];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
-
- [LCHttpHelper requestWithURLString:WalletInit parameters:nil needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
-
- YMWealthModel *model = [YMWealthModel yy_modelWithJSON:[dict dictionaryValueForKey:@"data" defaultValue:@{}]];
-
- self.userBalance = model.account.coin;
- self.userEarnings = stringFormat(@"%ld",model.account.income_coin);
- }else{
- [ZCHUDHelper showTitle:[dict stringValueForKey:@"message" defaultValue:@""]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- - (void)videoDoNotDisturbStatus{
- //0不接视频 1可以接视频
- NSInteger status = [LCSaveData getVideoOpenStatu] ? 0 : 1;
- [LCHttpHelper requestWithURLString:BigCastSetVideoStatus parameters:@{
- @"status":@(status)
- } needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- if (status == 0) {
- [ZCHUDHelper showTitle:@"关闭视频开关"];
- [LCSaveData saveVideoOpenStatu:NO];
- }else{
- [ZCHUDHelper showTitle:@"打开视频开关"];
- [LCSaveData saveVideoOpenStatu:YES];
- }
-
- self.commonFunctionsTwoListDataArray = [[self.commonFunctionsTwoListDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable commonFunctionsTwoDic) {
- // YMCommonFunctionsType type = [commonFunctionsTwoDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- // 是否是女性
- // if (self.userGender != 1) {
- // if (type == YMCommonFunctionsTypeVideoDoNotDisturb) {
- // return NO;
- // } else {
- // return YES;
- // }
- // }else{
- // return YES;
- // }
- return YES;
- }] map:^(NSDictionary * _Nullable commonFunctionsTwoDic) {
- NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithDictionary:commonFunctionsTwoDic];
- YMCommonFunctionsType type = [dataDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- switch (type) {
- case YMCommonFunctionsTypeVideoDoNotDisturb:
- if (status == 0) {
- [dataDic setObject:@(NO) forKey:@"isOpen"];
- }else{
- [dataDic setObject:@(YES) forKey:@"isOpen"];
- }
- break;
- default:
- break;
- }
- return dataDic;
- }].array;
-
- [self.refreshUISubject sendNext:@(YMRefreshUI)];
- } else {
- [ZCHUDHelper showTitle:[dict stringValueForKey:@"message" defaultValue:@""]];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)privateLetterChatStatus{
- NSInteger status = [LCSaveData getProfileWuraoStatus] ? 1 : 0;
- [LCHttpHelper requestWithURLString:SetWuRaoStatus parameters:@{
- @"is_msg_refuse":@(status)
- } needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- if (status == 1) {
- [ZCHUDHelper showTitle:@"关闭私信聊天"];
- [LCSaveData saveProfileWuraoStatus:NO];
- }else{
- [ZCHUDHelper showTitle:@"打开私信聊天"];
- [LCSaveData saveProfileWuraoStatus:YES];
-
- }
-
- self.commonFunctionsTwoListDataArray = [[self.commonFunctionsTwoListDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable commonFunctionsTwoDic) {
- // YMCommonFunctionsType type = [commonFunctionsTwoDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- // 是否是女性
- // if (self.userGender != 1) {
- // if (type == YMCommonFunctionsTypeVideoDoNotDisturb) {
- // return NO;
- // } else {
- // return YES;
- // }
- // }else{
- // return YES;
- // }
- return YES;
- }] map:^(NSDictionary * _Nullable commonFunctionsTwoDic) {
- NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithDictionary:commonFunctionsTwoDic];
- YMCommonFunctionsType type = [dataDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- switch (type) {
- case YMCommonFunctionsTypePrivateLetterChat:
- if (status == 1) {
- [dataDic setObject:@(NO) forKey:@"isOpen"];
- }else{
- [dataDic setObject:@(YES) forKey:@"isOpen"];
- }
- break;
- default:
- break;
- }
- return dataDic;
- }].array;
-
- [self.refreshUISubject sendNext:@(YMRefreshUI)];
- }else{
- [ZCHUDHelper showTitle:[dict stringValueForKey:@"message" defaultValue:@""]];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)privateLetterSoundStatus{
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- if ([LCSaveData getIMMsgVoice]) {
- [LCSaveData saveIMMsgVoice:NO];
- }else{
- [LCSaveData saveIMMsgVoice:YES];
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- self.commonFunctionsTwoListDataArray = [[self.commonFunctionsTwoListDataArray.rac_sequence filter:^BOOL(NSDictionary * _Nullable commonFunctionsTwoDic) {
- // YMCommonFunctionsType type = [commonFunctionsTwoDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- // 是否是女性
- // if (self.userGender != 1) {
- // if (type == YMCommonFunctionsTypeVideoDoNotDisturb) {
- // return NO;
- // } else {
- // return YES;
- // }
- // }else{
- // return YES;
- // }
- return YES;
- }] map:^(NSDictionary * _Nullable commonFunctionsTwoDic) {
- NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithDictionary:commonFunctionsTwoDic];
- YMCommonFunctionsType type = [dataDic integerValueForKey:ParamsCategoryType defaultValue:YMCommonFunctionsTypePrivateLetterChat];
- switch (type) {
- case YMCommonFunctionsTypePrivateLetterSound:
- if ([LCSaveData getIMMsgVoice]) {
- [dataDic setObject:@(YES) forKey:@"isOpen"];
- }else{
- [dataDic setObject:@(NO) forKey:@"isOpen"];
- }
- break;
- default:
- break;
- }
- return dataDic;
- }].array;
-
- [self.refreshUISubject sendNext:@(YMRefreshUI)];
- });
- });
- }
- - (void)copyUserId{
- UIPasteboard *pab = [UIPasteboard generalPasteboard];
- pab.string = self.userCode?:@"";
- if (pab == nil) {
- [ZCHUDHelper showTitle:@"复制失败"];
- }else{
- [ZCHUDHelper showTitle:@"已复制到剪切板"];
- }
- // MSYMineinfoEditVC *vc = [[MSYMineinfoEditVC alloc]init];
- // YOUPAILZUserShowVC *vc = [[YOUPAILZUserShowVC alloc]init];
- // vc.youpaipuserId = stringFormat(@"%ld",self.userId);
- // YOUPAILZProfitVC *vc = [[YOUPAILZProfitVC alloc]init];
- // [[YMGlobalUtils getCurrentVC].navigationController pushViewController:vc animated:YES];
- }
- /// 前往编辑资料
- - (void)gotoEditProfile{
- YMEditProfileViewModel *editProfileVM = [[YMEditProfileViewModel alloc]initWithParams:@{
- ParamsId:@(self.userId)
- }];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_EDIT_PROFILE) withUserInfo:@{
- RouterViewModel:editProfileVM
- } completion:nil];
- }
- - (void)gotoMemberCenter{
- YMMemberCenterViewModel *memberCenterVM = [[YMMemberCenterViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_MEMBER_CENTER) withUserInfo:@{
- RouterViewModel:memberCenterVM
- } completion:nil];
- }
- - (void)gotoAccountBalance{
- YMAccountBalanceViewModel *accountBalanceVM = [[YMAccountBalanceViewModel alloc]initWithParams:@{
- ParamsId:@(self.userId)
- }];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_ACCOUNT_BALANCE) withUserInfo:@{
- RouterViewModel:accountBalanceVM
- } completion:nil];
- }
- - (void)gotoMyEarnings{
- YMMyEarningsViewModel *myEarningsVM = [[YMMyEarningsViewModel alloc]initWithParams:@{
- ParamsId:@(self.userId)
- }];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_MY_EARNINGS) withUserInfo:@{
- RouterViewModel:myEarningsVM
- } completion:nil];
- }
- - (RACSubject *)quantityInfoOperationSubject{
- if (!_quantityInfoOperationSubject) {
- _quantityInfoOperationSubject = [RACSubject subject];
- }
- return _quantityInfoOperationSubject;
- }
- - (RACSubject *)commonFunctionsOperationSubject{
- if (!_commonFunctionsOperationSubject) {
- _commonFunctionsOperationSubject = [RACSubject subject];
- }
- return _commonFunctionsOperationSubject;
- }
- @end
|