diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index fc5f368..e8bb79e 100644 Binary files a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index c1a5fdc..976c777 100644 --- a/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/LekangGuard.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -286,9 +286,9 @@ filePath = "LekangGuard/Home/MoreService (更多功能)/EditDeviceViewController.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "495" - endingLineNumber = "495" - landmarkName = "-imagePickerController:didFinishPickingMediaWithInfo:" + startingLineNumber = "509" + endingLineNumber = "509" + landmarkName = "-DeviceMsgView" landmarkType = "7"> @@ -530,6 +530,38 @@ endingLineNumber = "123" landmarkName = "-GetUnReadTotal" landmarkType = "7"> + + + + + + @@ -45,6 +46,12 @@ - (void)setTitleArr:(NSArray *)titleArr { _titleArr = titleArr; +// [self.menuCollectionView reloadData]; +} + +- (void)setChatCoutn:(NSInteger)chatCoutn +{ + _chatCoutn = chatCoutn; [self.menuCollectionView reloadData]; } @@ -133,6 +140,7 @@ { cell.imgStr = self.imgArr[indexPath.row]; cell.titleStr = self.titleArr[indexPath.row]; + cell.chatCoutn = self.chatCoutn; } return cell; } @@ -172,6 +180,11 @@ vc.viewType = [title isEqualToString:GJText(@"设备闹钟")] ? 1 : 2; [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; } + if ([title isEqualToString:@"微聊"]) + { + ChatViewController *vc = [[ChatViewController alloc] init]; + [[UICommon currentVC].navigationController pushViewController:vc animated:YES]; + } if ([title isEqualToString:GJText(@"查找设备")]) { EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:GJText(@"查找设备") subtitle:GJText(@"\n点击查找设备,设备接收到指令,会响铃60秒,按任意键可以取消。若设备处于关机或未联网状态,则无法向设备端发送相关指令") AlertViewType:AlertViewTypeSystemAlert config:nil]; diff --git a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.h b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.h index e6fb226..f6590aa 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.h +++ b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.h @@ -15,6 +15,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic ,strong) NSString *imgStr; @property (nonatomic ,strong) NSString *titleStr; +/// 微聊消息未读数 +@property (nonatomic ,assign) NSInteger chatCoutn; + @end NS_ASSUME_NONNULL_END diff --git a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m index 692ea10..8d3eab6 100644 --- a/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m +++ b/LekangGuard/Home/MoreService (更多功能)/View/MenuCollectionViewCell.m @@ -10,6 +10,7 @@ @interface MenuCollectionViewCell () @property (nonatomic ,weak) UIImageView *iconImg; @property (nonatomic ,weak) UILabel *titleLabel; +@property (nonatomic ,weak) UILabel *msgNumLabel; @end @@ -38,6 +39,26 @@ self.iconImg.image = ImageName_(imgStr); } +- (void)setChatCoutn:(NSInteger)chatCoutn +{ + _chatCoutn = chatCoutn; + self.msgNumLabel.hidden = YES; + if ([self.titleStr isEqualToString:@"微聊"]) + { + self.msgNumLabel.hidden = chatCoutn > 0 ? NO : YES; + self.msgNumLabel.text = [NSString stringWithFormat:@"%ld",chatCoutn]; + if (chatCoutn > 0) + { + CGFloat ww = chatCoutn > 9 && chatCoutn < 100 ? 25 : chatCoutn > 99 ? 32 : 20; + [self.msgNumLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.iconImg.mas_right).offset(5); + make.top.equalTo(self.iconImg); + make.size.mas_equalTo(CGSizeMake(ww, 20)); + }]; + } + } +} + - (void)subMenuCell { UIImage *img = ImageName_(@"icon_watch_data"); @@ -58,6 +79,21 @@ make.centerX.equalTo(self.contentView); }]; + + UILabel *msgNumLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(13) textColor:KKWhiteColorColor text:@"" Radius:10]; + + msgNumLabel.layer.borderWidth = 1.5; + msgNumLabel.layer.borderColor = KKWhiteColorColor.CGColor; + msgNumLabel.backgroundColor = RGB(254, 83, 71); + msgNumLabel.hidden = YES; + self.msgNumLabel = msgNumLabel; + [self.contentView addSubview:msgNumLabel]; + [msgNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(iconImg.mas_right).offset(3); + make.top.equalTo(iconImg).offset(-3); + make.size.mas_equalTo(CGSizeMake(20, 20)); + }]; + // UILabel *line = [UILabel new]; // line.backgroundColor = KKLineColor; // [self.contentView addSubview:line]; diff --git a/LekangGuard/Managers/UIURL.h b/LekangGuard/Managers/UIURL.h index 883299a..85ca376 100644 --- a/LekangGuard/Managers/UIURL.h +++ b/LekangGuard/Managers/UIURL.h @@ -237,19 +237,19 @@ #define QueryContentById_URL @"/message/query/queryContentById" /// 新增消息 POST -#define AddChat_URL @"/chat_group_message_app/message/addChat" +#define AddChat_URL @"/chat-group-member-app/message/addChat" /// 查询微聊数据GET -#define QueryChat_URL @"/chat_group_message_app/message/queryChat" +#define QueryChat_URL @"/chat-group-member-app/message/queryChat" /// 根据消息id更新当前消息为已读状态GET -#define UpdateById_URL @"/chat_group_message_app/message/updateById" +#define UpdateById_URL @"/chat-group-message-app/message/updateById" /// 删除微聊数据GET -#define DeleteChat_URL @"/chat_group_message_app/message/deleteChat" +#define DeleteChat_URL @"/chat-group-message-app/message/deleteChat" /// 查询当前设备用户未读消息数 GET -#define UnreadTotal_URL @"/chat_group_message_app/message/unreadTotal" +#define UnreadTotal_URL @"/chat-group-message-app/message/unreadTotal" /// 用户注销 diff --git a/LekangGuard/My/VC/MyViewController.m b/LekangGuard/My/VC/MyViewController.m index c2e74c4..ec56301 100644 --- a/LekangGuard/My/VC/MyViewController.m +++ b/LekangGuard/My/VC/MyViewController.m @@ -56,14 +56,13 @@ [alertV showAlertView]; }]; - - self.myDataSource = [[NSMutableArray alloc] initWithObjects:@"消息中心",@"校园通知",@"关于我们",@"常见问题",@"清除缓存",@"意见反馈", nil]; - self.iconImageArr = [[NSMutableArray alloc] initWithObjects:@"icon_message_center",@"icon_campus_news",@"icon_aboutus",@"icon_question",@"icon_cleanup",@"icon_feedback", nil]; - + [self.view addSubview:self.moreTableView]; } + + - (UITableView *)moreTableView { if (!_moreTableView) @@ -202,6 +201,14 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; + self.myDataSource = [[NSMutableArray alloc] initWithObjects:@"消息中心",@"校园通知",@"关于我们",@"常见问题",@"清除缓存",@"意见反馈", nil]; + self.iconImageArr = [[NSMutableArray alloc] initWithObjects:@"icon_message_center",@"icon_campus_news",@"icon_aboutus",@"icon_question",@"icon_cleanup",@"icon_feedback", nil]; + + if (APIManager.sharedManager.deviceList.count <= 0 || APIManager.sharedManager.deviceModel.virtualFlag) + { + self.myDataSource = [[NSMutableArray alloc] initWithObjects:@"消息中心",@"关于我们",@"常见问题",@"清除缓存",@"意见反馈", nil]; + self.iconImageArr = [[NSMutableArray alloc] initWithObjects:@"icon_message_center",@"icon_aboutus",@"icon_question",@"icon_cleanup",@"icon_feedback", nil]; + } [self QueryMsg]; [self GetUnReadTotal]; } diff --git a/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m index 9353f64..d6b7f16 100644 --- a/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m +++ b/LekangGuard/Protection(守护星)/VC/ProtectionViewController.m @@ -31,6 +31,8 @@ @property (nonatomic ,weak) UIButton *unbundleBtn; + + @end @@ -197,6 +199,11 @@ // [self.menuArr addObject:GJText(@"上课禁用")]; // [self.menuImgArr addObject:@"icon_class_disable"]; // } +// if([APIManager sharedManager].deviceModel.chatFun) +// { +// [self.menuArr addObject:GJText(@"微聊")]; +// [self.menuImgArr addObject:@"icon_wechat"]; +// } if([APIManager sharedManager].deviceModel.lookupFun) { [self.menuArr addObject:GJText(@"查找设备")]; @@ -294,6 +301,22 @@ }]; } +#pragma mark 查询当前设备用户微聊未读消息数 +/// 查询当前设备用户微聊未读消息数 +- (void)GetUnreadTotal +{ + NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; + [parameters setValue:APIManager.sharedManager.deviceModel.groupid forKey:@"groupId"]; + [[[APIManager sharedManager] APGET:UnreadTotal_URL parameters:parameters resultClass:nil] subscribeNext:^(NSString *x) { + [UICommon HidenLoading]; + NSInteger chatCoutn = x.integerValue; + self.funView.chatCoutn = chatCoutn; + } error:^(NSError * _Nullable error) { + NSDictionary *dic = error.userInfo; + [UICommon MessageErrorText:dic[NSLocalizedDescriptionKey]]; + }]; +} + - (void)updateAllMessage { AfterDispatch(1, ^{ @@ -317,6 +340,7 @@ { [super viewWillAppear:animated]; [self realTimeUpadteMsg]; + [self GetUnreadTotal]; } diff --git a/Pods/MSNetwork/MSNetwork/MSNetwork.m b/Pods/MSNetwork/MSNetwork/MSNetwork.m index 6f047cb..cadf4e7 100644 --- a/Pods/MSNetwork/MSNetwork/MSNetwork.m +++ b/Pods/MSNetwork/MSNetwork/MSNetwork.m @@ -295,7 +295,7 @@ cachePolicy:(MSCachePolicy)cachePolicy NSData *data = [NSData dataWithContentsOfFile:filePath]; [formData appendPartWithFileData:data name:@"file" - fileName:@"voice" + fileName:@"voice.amr" mimeType:@"amr"]; } progress:^(NSProgress * _Nonnull uploadProgress) { //上传进度