Browse Source

群发消息-开发中

xie.bx 3 years ago
parent
commit
72db87651d

+ 1 - 1
im-platform/src/main/java/com/lx/implatform/entity/Friends.java

@@ -21,7 +21,7 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("friends")
+@TableName("im_friends")
 public class Friends extends Model<Friends> {
 
     private static final long serialVersionUID=1L;

+ 2 - 1
im-platform/src/main/java/com/lx/implatform/entity/Group.java

@@ -22,7 +22,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("group")
+@TableName("im_group")
 public class Group extends Model<Group> {
 
     private static final long serialVersionUID = 1L;
@@ -36,6 +36,7 @@ public class Group extends Model<Group> {
     /**
      * 群名字
      */
+    @TableField("name")
     private String name;
 
     /**

+ 4 - 4
im-platform/src/main/java/com/lx/implatform/entity/GroupMember.java

@@ -25,7 +25,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("group_member")
+@TableName("im_group_member")
 public class GroupMember extends Model<GroupMember> {
 
     private static final long serialVersionUID = 1L;
@@ -51,7 +51,7 @@ public class GroupMember extends Model<GroupMember> {
     /**
      *  群内显示名称
      */
-    @TableField("user_id")
+    @TableField("alias_name")
     private String aliasName;
 
     /**
@@ -65,8 +65,8 @@ public class GroupMember extends Model<GroupMember> {
     /**
      * 备注
      */
-    @TableField("remarks")
-    private String remarks;
+    @TableField("remark")
+    private String remark;
 
     /**
      * 创建时间

+ 1 - 1
im-platform/src/main/java/com/lx/implatform/entity/GroupMessage.java

@@ -25,7 +25,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("group_message")
+@TableName("im_group_message")
 public class GroupMessage extends Model<GroupMessage> {
 
     private static final long serialVersionUID = 1L;

+ 1 - 1
im-platform/src/main/java/com/lx/implatform/entity/GroupMessageReadPos.java

@@ -25,7 +25,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("group_message_read_pos")
+@TableName("im_group_message_read_pos")
 public class GroupMessageReadPos extends Model<GroupMessageReadPos> {
 
     private static final long serialVersionUID = 1L;

+ 1 - 1
im-platform/src/main/java/com/lx/implatform/entity/SingleMessage.java

@@ -21,7 +21,7 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("single_message")
+@TableName("im_single_message")
 public class SingleMessage extends Model<SingleMessage> {
 
     private static final long serialVersionUID=1L;

+ 1 - 1
im-platform/src/main/java/com/lx/implatform/entity/User.java

@@ -21,7 +21,7 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
-@TableName("user")
+@TableName("im_user")
 public class User extends Model<User> {
 
     private static final long serialVersionUID=1L;

+ 3 - 3
im-platform/src/main/java/com/lx/implatform/service/impl/GroupServiceImpl.java

@@ -70,7 +70,7 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
     /**
      * 修改群聊信息
      * 
-     * @Param  GroupVO  群聊信息
+     * @Param  GroupVO 群聊信息
      * @return GroupVO
      **/
     @Override
@@ -91,7 +91,7 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
      * 删除群聊
      * 
      * @Param groupId 群聊id
-     * @return void
+     * @return
      **/
     @Transactional
     @Override
@@ -140,8 +140,8 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
     /**
      * 邀请好友进群
      *
-     * @return
      * @Param GroupInviteVO  群id、好友id列表
+     * @return
      **/
     @Override
     public void invite(GroupInviteVO vo) {

+ 11 - 11
im-platform/src/main/resources/db/db.sql

@@ -1,5 +1,5 @@
 use `lx-im`;
-create table `user`(
+create table `im_user`(
     `id` bigint not null auto_increment primary key  comment 'id',
     `user_name` varchar(255) not null comment '用户名',
     `nick_name` varchar(255) not null comment '用户昵称',
@@ -14,7 +14,7 @@ create table `user`(
     key `idx_nick_name`(nick_name)
 ) ENGINE=InnoDB CHARSET=utf8mb3 comment '用户';
 
-create table `friends`(
+create table `im_friends`(
     `id` bigint not null auto_increment primary key  comment 'id',
     `user_id` bigint not null  comment '用户id',
     `friend_id` bigint not null  comment '好友id',
@@ -25,7 +25,7 @@ create table `friends`(
     key `idx_friend_id` (`friend_id`)
 ) ENGINE=InnoDB CHARSET=utf8mb3 comment '好友';
 
-create table `single_message`(
+create table `im_single_message`(
     `id` bigint not null auto_increment primary key comment 'id',
     `send_user_id` bigint not null  comment '发送用户id',
     `recv_user_id` bigint not null  comment '接收用户id',
@@ -37,30 +37,30 @@ create table `single_message`(
 )ENGINE=InnoDB CHARSET=utf8mb3 comment '私聊消息';
 
 
-create table `group`(
+create table `im_group`(
     `id` bigint not null auto_increment primary key comment 'id',
     `name` varchar(255) not null comment '群名字',
     `owner_id` bigint not null  comment '群主id',
     `head_image` varchar(255) default '' comment '群头像',
     `head_image_thumb` varchar(255) default '' comment '群头像缩略图',
-    `notice` text   comment '群公告',
+    `notice` varchar(1024)  default '' comment '群公告',
     `remark` varchar(255) default '' comment '群备注',
     `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间'
-)ENGINE=InnoDB  comment '群';
+)ENGINE=InnoDB CHARSET=utf8mb3 comment '群';
 
-create table `group_member`(
+create table `im_group_member`(
     `id` bigint not null auto_increment primary key comment 'id',
     `group_id` bigint not null  comment '群id',
     `user_id` bigint not null  comment '用户id',
     `alias_name` varchar(255) DEFAULT '' comment '组内显示名称',
     `head_image` varchar(255) default '' comment '用户头像',
-    `remarks` varchar(255) DEFAULT '' comment '备注',
+    `remark` varchar(255) DEFAULT '' comment '备注',
     `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
     key `idx_group_id`(`group_id`),
     key `idx_user_id`(`user_id`)
-)ENGINE=InnoDB  comment '群成员';
+)ENGINE=InnoDB CHARSET=utf8mb3 comment '群成员';
 
-create table `group_message`(
+create table `im_group_message`(
     `id` bigint not null auto_increment primary key comment 'id',
     `group_id` bigint not null  comment '群id',
     `send_user_id` bigint not null  comment '发送用户id',
@@ -71,7 +71,7 @@ create table `group_message`(
 )ENGINE=InnoDB CHARSET=utf8mb3 comment '群消息';
 
 
-create table `group_message_read_pos`(
+create table `im_group_message_read_pos`(
      `id` bigint not null auto_increment primary key comment 'id',
      `group_id` bigint not null  comment '群id',
      `user_id` bigint not null  comment '用户id',

+ 5 - 0
im-ui/src/router/index.js

@@ -36,6 +36,11 @@ export default new VueRouter({
 		  name: "Friends",
 		  path: "/home/friends",
 		  component: () => import("../view/Friends"),
+		},
+		{
+		  name: "Friends",
+		  path: "/home/group",
+		  component: () => import("../view/Group"),
 		}
 	  ]
     }

+ 1 - 1
im-ui/src/store/friendsStore.js

@@ -8,7 +8,7 @@ export default {
 		timer: null
 	},
 	mutations: {
-		initFriendsStore(state, userInfo) {
+		initFriendsStore(state) {
 			httpRequest({
 				url: '/api/friends/list',
 				method: 'get'

+ 19 - 18
im-ui/src/view/Friends.vue

@@ -1,18 +1,14 @@
 <template>
 	<el-container>
 		<el-aside width="250px" class="l-friend-box">
-			<el-header height="60px">
-				<el-row>
-					<el-col :span="19">
-						<el-input width="200px" placeholder="搜索好友" v-model="searchText">
-							<el-button slot="append" icon="el-icon-search"></el-button>
-						</el-input>
-					</el-col>
-					<el-col :span="1"></el-col>
-					<el-col :span="3">
-						<el-button plain icon="el-icon-plus" style="border: none; font-size: 20px;color: black;" title="添加好友" @click="onShowAddFriends"></el-button>
-					</el-col>
-				</el-row>
+			<el-header class="l-friend-header" height="60px">
+				<div class="l-friend-search">
+					<el-input width="200px" placeholder="搜索好友" v-model="searchText">
+						<el-button slot="append" icon="el-icon-search"></el-button>
+					</el-input>
+				</div>
+				<el-button plain icon="el-icon-plus" style="border: none; padding:12px; font-size: 20px;color: black;" title="添加好友" @click="onShowAddFriends"></el-button>
+
 				<add-friends :dialogVisible="showAddFriend" @close="onCloseAddFriends" @add="onAddFriend()">
 				</add-friends>
 			</el-header>
@@ -83,7 +79,7 @@
 					// 如果发现好友的头像和昵称改了,进行更新
 					if (userInfo.headImageThumb != friendsInfo.friendHeadImage ||
 						userInfo.nickName != friendsInfo.friendNickName) {
-						this.updateFriendInfo(friendsInfo, userInfo,index)
+						this.updateFriendInfo(friendsInfo, userInfo, index)
 					}
 				})
 			},
@@ -111,7 +107,7 @@
 				this.$store.commit("activeChat", 0);
 				this.$router.push("/home/chat");
 			},
-			updateFriendInfo(friendsInfo, userInfo,index) {
+			updateFriendInfo(friendsInfo, userInfo, index) {
 				friendsInfo.friendHeadImage = userInfo.headImageThumb;
 				friendsInfo.friendNickName = userInfo.nickName;
 				this.$http({
@@ -119,8 +115,8 @@
 					method: "put",
 					data: friendsInfo
 				}).then(() => {
-					this.$store.commit("updateFriends",friendsInfo);
-					this.$store.commit("setChatUserInfo",userInfo);
+					this.$store.commit("updateFriends", friendsInfo);
+					this.$store.commit("setChatUserInfo", userInfo);
 				})
 			}
 		}
@@ -134,10 +130,15 @@
 			border: #dddddd solid 1px;
 			background: #eeeeee;
 
-			.el-header {
+			.l-friend-header {
+				display: flex;
+				align-items: center;
 				padding: 5px;
 				background-color: white;
-				line-height: 50px;
+				
+				.l-friend-search{
+					flex: 1;
+				}
 			}
 
 			.el-main {

+ 6 - 0
im-ui/src/view/Home.vue

@@ -16,6 +16,12 @@
 						<span class="el-icon-user"></span>
 					</router-link>
 				</el-menu-item>
+				<el-menu-item  title="群聊" >
+					<router-link v-bind:to="'/home/group'">
+						<span class="el-icon-s-check"></span>
+					</router-link>
+				</el-menu-item>
+				
 				<el-menu-item title="设置" @click="onClickSetting()" >
 						<span class="el-icon-setting"></span>
 				</el-menu-item>