RQProfileViewModel.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. //
  2. // RQProfileViewModel.m
  3. // RQCommon
  4. //
  5. // Created by 张嵘 on 2018/11/21.
  6. // Copyright © 2018 张嵘. All rights reserved.
  7. //
  8. #import "RQProfileViewModel.h"
  9. #import "RQCustomWebViewViewController.h"
  10. #import "QMChatRoomViewController.h"
  11. #import <QMLineSDK/QMLineSDK.h>
  12. #import "QMAlert.h"
  13. @interface RQProfileViewModel ()
  14. @property (nonatomic, readwrite , copy) NSArray *menuInfoArr;
  15. @property (nonatomic, readwrite, strong) RACCommand *requestMenuInfoCommand;
  16. //客服
  17. @property (nonatomic, assign) BOOL isPushed; // 控制跳转
  18. @property (nonatomic, assign) BOOL isConnecting; // 控制多次注册
  19. @property (nonatomic, copy) NSDictionary * dictionary; //客服一些配置
  20. @end
  21. @implementation RQProfileViewModel
  22. - (instancetype)initWithServices:(id<RQViewModelServices>)services params:(NSDictionary *)params{
  23. if (self = [super initWithServices:services params:params]) {
  24. }
  25. return self;
  26. }
  27. - (void)initialize {
  28. [super initialize];
  29. @weakify(self);
  30. self.title = @"";
  31. self.prefersNavigationBarBottomLineHidden = YES;
  32. self.prefersNavigationBarHidden = YES;
  33. [self rq_configureData];
  34. // RAC(self, menuInfoArr) = self.requestMenuInfoCommand.executionSignals.switchToLatest;
  35. // /// 过滤错误信息
  36. // [[self.requestMenuInfoCommand.errors
  37. // filter:^(NSError *error) {
  38. // return YES;
  39. // }] subscribe:self.errors];
  40. [[self.requestMenuInfoCommand execute:nil] subscribeNext:^(id _Nullable x) {
  41. @strongify(self)
  42. self.menuInfoArr = x;
  43. } completed:^{
  44. }];
  45. [RQ_Profile_Module getVipInfo];
  46. //客服
  47. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerSuccess:) name:CUSTOM_LOGIN_SUCCEED object:nil];
  48. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerFailure:) name:CUSTOM_LOGIN_ERROR_USER object:nil];
  49. [RQNotificationCenter addObserver:self selector:@selector(wxLoginNotif:) name:RQWeChatOnRespNotification object:nil]; //注册微信登录
  50. }
  51. - (RACCommand *)requestMenuInfoCommand {
  52. @weakify(self)
  53. return [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id _Nullable input) {
  54. @strongify(self)
  55. return [[self requestMenuInfoSignal] takeUntil:self.rac_willDeallocSignal];
  56. }];
  57. }
  58. - (RACSignal *)requestMenuInfoSignal {
  59. return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber> _Nonnull subscriber) {
  60. [[RQ_HTTP_Service getMenuInfo] subscribeNext:^(NSArray *arr) {
  61. NSArray *itemArr = [arr.rac_sequence.signal map:^id _Nullable(RQMenuInfoModel *menuInfoModel) {
  62. RQCommonCollectionItemViewModel *menuInfoItem = [RQCommonCollectionItemViewModel itemViewModelWithTitle:menuInfoModel.MENU_NAME icon:menuInfoModel.MENU_ICON];
  63. menuInfoItem.operation = ^{
  64. if ([menuInfoModel.MENU_TYPE isEqualToString:@"1"]) {
  65. [RQ_SHARE_FUNCTION gotoWebViewWithUrlStr:menuInfoModel.MENU_URL];
  66. } else if ([menuInfoModel.MENU_TYPE isEqualToString:@"2"]) {
  67. [RQ_SHARE_FUNCTION miniwithUserName:menuInfoModel.MENU_URL path:menuInfoModel.MENU_XCX_URL];
  68. } else if ([menuInfoModel.MENU_TYPE isEqualToString:@"3"]) {
  69. if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:menuInfoModel.MENU_URL]]) {
  70. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:menuInfoModel.MENU_URL] options:@{} completionHandler:^(BOOL success) {}];
  71. } else {
  72. if (![menuInfoModel.MENU_WEB_URL isEqualToString:@""]) {
  73. [RQ_SHARE_FUNCTION gotoWebViewWithUrlStr:menuInfoModel.MENU_WEB_URL];
  74. } else {
  75. NSString *urlStr = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/cn/app/id%@?mt=8",menuInfoModel.MENU_IOS];
  76. NSURL *url = [NSURL URLWithString:urlStr];
  77. [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
  78. }];
  79. }
  80. }
  81. } else if ([menuInfoModel.MENU_TYPE isEqualToString:@"4"]) {
  82. // [NSObject rq_showAlertViewWithTitle:@"温馨提示" message:@"是否捐赠少量资金" confirmTitle:@"是" cancelTitle:@"否" confirmAction:^{
  83. // [[RQ_HTTP_Service postPrepareOrderWithDictCode:35 userId:RQ_USER_MANAGER.currentUser._id] subscribeNext:^(RQPrepareOrderModel *prepareOrderModel) {
  84. // PayReq *req = [[PayReq alloc] init];
  85. // req.openID = RQ_WECHAT_MANAGER.appID;
  86. // req.partnerId = prepareOrderModel.partnerId;
  87. // req.prepayId = prepareOrderModel.prepayId;
  88. // req.package = prepareOrderModel.packageValue;
  89. // req.nonceStr = prepareOrderModel.nonceStr;
  90. // NSString * stamp = prepareOrderModel.timeStamp;
  91. // req.timeStamp = (UInt32)stamp.intValue;
  92. // req.sign = prepareOrderModel.sign;
  93. //// [RQWechatManager hangleWechatPayWith:req];
  94. // }];
  95. // } cancelAction:^{
  96. // }];
  97. }
  98. };
  99. return menuInfoItem;
  100. }].toArray;
  101. [subscriber sendNext:itemArr];
  102. } error:^(NSError * _Nullable error) {
  103. [subscriber sendError:error];
  104. } completed:^{
  105. [subscriber sendCompleted];
  106. }];
  107. return [RACDisposable disposableWithBlock:^{}];
  108. }];
  109. }
  110. #pragma mark - 配置数据
  111. - (void)rq_configureData {
  112. @weakify(self)
  113. /// 第一组
  114. RQCommonGroupViewModel *group0 = [RQCommonGroupViewModel groupViewModel];
  115. RQProfileUserAndVipItemViewModel *profileUserAndVipItemViewModel = [[RQProfileUserAndVipItemViewModel alloc] initViewModelWithUser:RQ_USER_MANAGER.currentUser];
  116. group0.itemViewModels = @[profileUserAndVipItemViewModel];
  117. /// 第二组
  118. RQCommonGroupViewModel *group1 = [RQCommonGroupViewModel groupViewModel];
  119. group1.footerHeight = 10.f;
  120. RQProfilePracticeItemViewModel *profilePracticeItemViewModel = [[RQProfilePracticeItemViewModel alloc] init];
  121. group1.itemViewModels = @[profilePracticeItemViewModel];
  122. /// 第三组
  123. RQProfileUserAndVipHeaderGroupViewModel *group2 = [RQProfileUserAndVipHeaderGroupViewModel groupViewModel];
  124. group2.header = @"我的工具";
  125. RQCommonCollectionItemViewModel *coupon = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"优惠券" icon:@"优惠券"];
  126. RQCommonCollectionItemViewModel *synchronizationProgress = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"同步进度" icon:@"同步进度"];
  127. synchronizationProgress.operation = ^{
  128. RQSynchronizationViewModel *synchronizationViewModel = [[RQSynchronizationViewModel alloc] initWithServices:self.services params:@{}];
  129. [self.services pushViewModel:synchronizationViewModel animated:YES];
  130. };
  131. RQCommonCollectionItemViewModel *myOrder = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"我的订单" icon:@"我的订单"];
  132. // RQCommonCollectionItemViewModel *retraining = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"复训" icon:@"复训"];
  133. RQCommonCollectionItemViewModel *transferQuery = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"转校查询" icon:@"转校"];
  134. transferQuery.operation = ^{
  135. @strongify(self)
  136. RQStudentChangeSchoolViewModel *studentChangeSchoolViewModel = [[RQStudentChangeSchoolViewModel alloc] initWithServices:self.services params:nil];
  137. [self.services pushViewModel:studentChangeSchoolViewModel animated:YES];
  138. };
  139. RQCommonCollectionItemViewModel *commonQuestion = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"常见问题" icon:@"常见问题"];
  140. commonQuestion.operation = ^{
  141. NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"https://support.qq.com/products/361288"]];
  142. RQCustomWebViewViewController *vc = [[RQCustomWebViewViewController alloc] init];
  143. vc.url = URL.absoluteString;
  144. vc.bodyDicArr = @[
  145. @{@"key" : @"nickname", @"value" : RQStringIsEmpty(RQ_USER_MANAGER.currentUser.userName)? @"游客" : RQ_USER_MANAGER.currentUser.userName},
  146. @{@"key" : @"avatar", @"value" : RQStringIsEmpty(RQ_USER_MANAGER.currentUser.photo)? @"" : RQ_USER_MANAGER.currentUser.photo},
  147. @{@"key" : @"openid", @"value" : RQStringIsEmpty(RQ_USER_MANAGER.currentUser.outId)? @"" : RQ_USER_MANAGER.currentUser.outId}
  148. ];
  149. RQBaseNavigationController *nav = [[RQBaseNavigationController alloc] initWithRootViewController:vc];
  150. [RQControllerHelper.topViewController presentViewController:nav animated:NO completion:nil];
  151. };
  152. RQCommonCollectionItemViewModel *test = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"电子资料" icon:@"电子资料"];
  153. test.operation = ^{
  154. NSLog(@"点击了-电子资料");
  155. [RQ_SHARE_FUNCTION miniwithUserName:RQ_COMMON_MANAGER.JSJP_XCX_NAME path:RQ_COMMON_MANAGER.JSJP_XCX_PAGE];
  156. };
  157. RQCommonCollectionItemViewModel *onlineService = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"联系客服" icon:@"联系客服"];
  158. onlineService.operation = ^{
  159. NSString *name = RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.userName)? RQ_USER_MANAGER.currentUser.userName : (RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.nickName)? RQ_USER_MANAGER.currentUser.nickName : @"游客");
  160. name = [NSString stringWithFormat:@"%@[极I学员_%@]",name,RQ_APP_VERSION];
  161. [QMConnect registerSDKWithAppKey:@"74442d40-9dc6-11e7-957d-a30a08c3a2c0" userName:name userId:RQ_USER_MANAGER.currentUser._id];
  162. };
  163. // group2.itemViewModels = @[coupon, synchronizationProgress, myOrder, transferQuery];
  164. group2.itemViewModels = @[test, synchronizationProgress, transferQuery, onlineService];
  165. // group2.itemViewModels = @[test, synchronizationProgress, onlineService];
  166. /// 第四组
  167. RQProfileUserAndVipHeaderGroupViewModel *group3 = [RQProfileUserAndVipHeaderGroupViewModel groupViewModel];
  168. group3.header = @"优惠相关";
  169. RAC(group3, itemViewModels) = [RACObserve(self, menuInfoArr) takeUntil:self.rac_willDeallocSignal];
  170. /// 第五组
  171. RQProfileUserAndVipHeaderGroupViewModel *group4 = [RQProfileUserAndVipHeaderGroupViewModel groupViewModel];
  172. group4.header = @"其他";
  173. #if defined(DEBUG)||defined(_DEBUG)
  174. /// 调试模式
  175. RQCommonCollectionItemViewModel *debug = [RQCommonCollectionItemViewModel itemViewModelWithTitle:@"打开/关闭调试器" icon:@"assistivetouch"];
  176. debug.operation = ^{
  177. [[RQDebugTouchView sharedInstance] setHide:![RQDebugTouchView sharedInstance].isHide];
  178. [RQSharedAppDelegate.window bringSubviewToFront:[RQDebugTouchView sharedInstance]];
  179. };
  180. /// 微信绑定
  181. NSString *title = @"绑定/解绑";// RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.openId)? @"微信绑定":@"微信解绑";
  182. RQCommonCollectionItemViewModel *wxModel = [RQCommonCollectionItemViewModel itemViewModelWithTitle:title icon:@"wxicon"];
  183. wxModel.operation = ^{
  184. NSLog(@"openid=%@",RQ_USER_MANAGER.currentUser.openId);
  185. if(RQ_USER_MANAGER.currentUser.openId==nil){//绑定
  186. [RQ_WECHAT_MANAGER wechatLogin];
  187. }else{//解绑
  188. //跳转-绑定
  189. NYLoginBindViewModel *viewModel = [[NYLoginBindViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  190. viewModel.openid = RQ_USER_MANAGER.currentUser.openId;
  191. viewModel.isBind = true;
  192. [RQ_APPDELEGATE.services pushViewModel:viewModel animated:YES];
  193. }
  194. };
  195. group4.itemViewModels = @[debug,wxModel];
  196. #else
  197. /// 微信绑定
  198. NSString *title = @"绑定/解绑";// RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.openId)? @"微信绑定":@"微信解绑";
  199. RQCommonCollectionItemViewModel *wxModel = [RQCommonCollectionItemViewModel itemViewModelWithTitle:title icon:@"wxicon"];
  200. wxModel.operation = ^{
  201. NSLog(@"openid=%@",RQ_USER_MANAGER.currentUser.openId);
  202. if(RQ_USER_MANAGER.currentUser.openId==nil){//绑定
  203. [RQ_WECHAT_MANAGER wechatLogin];
  204. }else{//解绑
  205. //跳转-绑定
  206. NYLoginBindViewModel *viewModel = [[NYLoginBindViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  207. viewModel.openid = RQ_USER_MANAGER.currentUser.openId;
  208. viewModel.isBind = true;
  209. [RQ_APPDELEGATE.services pushViewModel:viewModel animated:YES];
  210. }
  211. };
  212. /// 发布模式
  213. group4.itemViewModels = @[wxModel];
  214. #endif
  215. self.dataSource = group4.itemViewModels.count > 0? @[group0, group1, group2, group3, group4] : @[group0, group1, group2, group3];
  216. }
  217. #pragma mark 客服
  218. - (void)registerSuccess:(NSNotification *)sender {
  219. NSLog(@"注册成功");
  220. if (_isPushed) {
  221. [MBProgressHUD rq_showProgressHUD:@""];
  222. _isConnecting = NO;
  223. return;
  224. }
  225. [QMConnect sdkGetWebchatScheduleConfig:^(NSDictionary *scheduleDic) {
  226. dispatch_async(dispatch_get_main_queue(), ^{
  227. self.dictionary = scheduleDic;
  228. if ([self.dictionary[@"scheduleEnable"] intValue] == 1) {
  229. NSLog(@"日程管理");
  230. [self starSchedule];
  231. }else{
  232. NSLog(@"技能组");
  233. [self getPeers];
  234. }
  235. });
  236. } failBlock:^(NSString *str) {
  237. }];
  238. }
  239. - (void)registerFailure:(NSNotification *)sender {
  240. NSLog(@"注册失败::%@", sender.object);
  241. self.isConnecting = NO;
  242. [MBProgressHUD rq_hideHUD];
  243. }
  244. #pragma mark - 技能组选择
  245. - (void)getPeers {
  246. @weakify(self)
  247. [QMConnect sdkGetPeers:^(NSArray * _Nonnull peerArray) {
  248. dispatch_async(dispatch_get_main_queue(), ^{
  249. @strongify(self)
  250. NSLog(@"%@", peerArray);
  251. NSArray *peers = peerArray;
  252. self.isConnecting = NO;
  253. [MBProgressHUD rq_hideHUD];
  254. if (peers.count == 1 && peers.count != 0) {
  255. [self showChatRoomViewController:[peers.firstObject objectForKey:@"id"] processType:@""];
  256. }else {
  257. [self showPeersWithAlert:peers messageStr:@"选择您咨询的类型或业务部门(对应技能组)"];
  258. }
  259. });
  260. } failureBlock:^(NSString *str) {
  261. dispatch_async(dispatch_get_main_queue(), ^{
  262. @strongify(self)
  263. [MBProgressHUD rq_hideHUD];
  264. self.isConnecting = NO;
  265. });
  266. }];
  267. }
  268. #pragma mark - 日程管理
  269. - (void)starSchedule {
  270. self.isConnecting = NO;
  271. [MBProgressHUD rq_hideHUD];
  272. if ([self.dictionary[@"scheduleId"] isEqual: @""] || [self.dictionary[@"processId"] isEqual: @""] || [self.dictionary objectForKey:@"entranceNode"] == nil || [self.dictionary objectForKey:@"leavemsgNodes"] == nil) {
  273. [QMAlert showMessage:@"对不起,由于在线咨询配置错误,暂时无法进行咨询"];
  274. }else{
  275. NSDictionary *entranceNode = self.dictionary[@"entranceNode"];
  276. NSArray *entrances = entranceNode[@"entrances"];
  277. NSLog(@" 获取到日程节点数组 ===== %@", entrances);
  278. // [self showPeersWithAlert: sdkEntrances];
  279. if (entrances.count == 1 && entrances.count != 0) {
  280. [self showChatRoomViewController:[entrances.firstObject objectForKey:@"processTo"] processType:[entrances.firstObject objectForKey:@"processType"]];
  281. }else{
  282. [self showPeersWithAlert:entrances messageStr:@"选择您咨询的日程管理类型"];
  283. }
  284. }
  285. }
  286. - (void)showPeersWithAlert: (NSArray *)peers messageStr: (NSString *)message {
  287. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"选择您咨询的类型或业务部门(对应技能组)" preferredStyle:UIAlertControllerStyleAlert];
  288. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  289. self.isConnecting = NO;
  290. }];
  291. [alertController addAction:cancelAction];
  292. for (NSDictionary *index in peers) {
  293. UIAlertAction *surelAction = [UIAlertAction actionWithTitle:[index objectForKey:@"name"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  294. if ([self.dictionary[@"scheduleEnable"] integerValue] == 1) {
  295. [self showChatRoomViewController:[index objectForKey:@"processTo"] processType:[index objectForKey:@"processType"]];
  296. }else{
  297. [self showChatRoomViewController:[index objectForKey:@"id"] processType:@""];
  298. }
  299. }];
  300. [alertController addAction:surelAction];
  301. }
  302. [RQControllerHelper.currentViewController presentViewController:alertController animated:YES completion:nil];
  303. }
  304. #pragma mark - 跳转聊天界面
  305. - (void)showChatRoomViewController:(NSString *)peerId processType:(NSString *)processType {
  306. QMChatRoomViewController *chatRoomViewController = [[QMChatRoomViewController alloc] init];
  307. chatRoomViewController.peerId = peerId;
  308. chatRoomViewController.isPush = NO;
  309. NSString *path = defUser.userDict[@"photo"];
  310. if (!path) {
  311. path = @"";
  312. }
  313. chatRoomViewController.avaterStr = path;
  314. if ([self.dictionary[@"scheduleEnable"] intValue] == 1) {
  315. chatRoomViewController.isOpenSchedule = true;
  316. chatRoomViewController.scheduleId = self.dictionary[@"scheduleId"];
  317. chatRoomViewController.processId = self.dictionary[@"processId"];
  318. chatRoomViewController.currentNodeId = peerId;
  319. chatRoomViewController.processType = processType;
  320. }else{
  321. chatRoomViewController.isOpenSchedule = false;
  322. }
  323. // MyUINavigationController* nav = [[MyUINavigationController alloc] initWithRootViewController:chatRoomViewController];
  324. // [nav.view setBackgroundColor:[UIColor whiteColor]];
  325. // nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
  326. // nav.navigationBar.translucent = NO;
  327. // nav.modalPresentationStyle = UIModalPresentationFullScreen;
  328. // [RQControllerHelper.currentViewController.parentViewController presentViewController:nav animated:YES completion:nil];
  329. RQBaseNavigationController *nav = [[RQBaseNavigationController alloc] initWithRootViewController:chatRoomViewController];
  330. [RQControllerHelper.topViewController presentViewController:nav animated:YES completion:nil];
  331. // 此处为了统一“退出登录”返回方式 就选择了present进去
  332. }
  333. - (NSMutableAttributedString *)setSpace:(CGFloat)line kern:(NSNumber *)kern font:(UIFont *)font text:(NSString *)text {
  334. NSMutableParagraphStyle * paraStyle = [NSMutableParagraphStyle new];
  335. paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
  336. paraStyle.alignment = NSTextAlignmentCenter;
  337. paraStyle.lineSpacing = line;
  338. paraStyle.hyphenationFactor = 1.0;
  339. paraStyle.firstLineHeadIndent = 0.0;
  340. paraStyle.paragraphSpacingBefore = 0.0;
  341. paraStyle.headIndent = 0;
  342. paraStyle.tailIndent = 0;
  343. NSDictionary *attributes = @{
  344. NSFontAttributeName: font,
  345. NSParagraphStyleAttributeName: paraStyle,
  346. NSKernAttributeName: kern
  347. };
  348. NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:text attributes:attributes];
  349. return attributeStr;
  350. }
  351. - (void)wxLoginNotif:(NSNotification *)notif{
  352. if(RQ_USER_MANAGER.isLogin){
  353. NSString *code = [notif.object stringValue];
  354. //提交-web
  355. [MBProgressHUD rq_showProgressHUD:@""];
  356. [jiaPeiManager NYRequestAnythingDataWithURL:RQ_POST_Jsjpcode contentType:nil parameters:@{@"authorizationCode":code} completion:^(NSDictionary *dict) {
  357. if([dict[@"code"] intValue]==200){
  358. NYJsCodeModel *obj = [NYJsCodeModel yy_modelWithDictionary:dict[@"data"]];
  359. if(obj.gzptUserInfo==NULL){//如果-没有绑定-跳绑
  360. NYLoginBindViewModel *viewModel = [[NYLoginBindViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  361. viewModel.openid = obj.openid;
  362. [RQ_APPDELEGATE.services pushViewModel:viewModel animated:YES];
  363. }else{//绑定过-解绑
  364. NYLoginBindViewModel *viewModel = [[NYLoginBindViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  365. viewModel.openid = obj.openid;
  366. viewModel.isBind = true;
  367. [RQ_APPDELEGATE.services pushViewModel:viewModel animated:YES];
  368. }
  369. }else{
  370. }
  371. [MBProgressHUD rq_hideHUD];
  372. }];
  373. }
  374. }
  375. - (void)dealloc {
  376. [[NSNotificationCenter defaultCenter] removeObserver:self name:CUSTOM_LOGIN_SUCCEED object:nil];
  377. [[NSNotificationCenter defaultCenter] removeObserver:self name:CUSTOM_LOGIN_ERROR_USER object:nil];
  378. [[NSNotificationCenter defaultCenter] removeObserver:self name:RQWeChatOnRespNotification object:nil];
  379. }
  380. #pragma mark - LazyLoad
  381. - (NSArray *)menuInfoArr {
  382. if (!_menuInfoArr) {
  383. _menuInfoArr = @[];
  384. }
  385. return _menuInfoArr;
  386. }
  387. @end