Browse Source

群发消息-开发中

master
xie.bx 3 years ago
parent
commit
72db87651d
  1. 2
      im-platform/src/main/java/com/lx/implatform/entity/Friends.java
  2. 3
      im-platform/src/main/java/com/lx/implatform/entity/Group.java
  3. 8
      im-platform/src/main/java/com/lx/implatform/entity/GroupMember.java
  4. 2
      im-platform/src/main/java/com/lx/implatform/entity/GroupMessage.java
  5. 2
      im-platform/src/main/java/com/lx/implatform/entity/GroupMessageReadPos.java
  6. 2
      im-platform/src/main/java/com/lx/implatform/entity/SingleMessage.java
  7. 2
      im-platform/src/main/java/com/lx/implatform/entity/User.java
  8. 4
      im-platform/src/main/java/com/lx/implatform/service/impl/GroupServiceImpl.java
  9. 22
      im-platform/src/main/resources/db/db.sql
  10. 5
      im-ui/src/router/index.js
  11. 2
      im-ui/src/store/friendsStore.js
  12. 23
      im-ui/src/view/Friends.vue
  13. 6
      im-ui/src/view/Home.vue

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

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

3
im-platform/src/main/java/com/lx/implatform/entity/Group.java

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

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

@ -25,7 +25,7 @@ import lombok.EqualsAndHashCode;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("group_member") @TableName("im_group_member")
public class GroupMember extends Model<GroupMember> { public class GroupMember extends Model<GroupMember> {
private static final long serialVersionUID = 1L; 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; private String aliasName;
/** /**
@ -65,8 +65,8 @@ public class GroupMember extends Model<GroupMember> {
/** /**
* 备注 * 备注
*/ */
@TableField("remarks") @TableField("remark")
private String remarks; private String remark;
/** /**
* 创建时间 * 创建时间

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

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

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

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

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

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

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

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

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

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

22
im-platform/src/main/resources/db/db.sql

@ -1,5 +1,5 @@
use `lx-im`; use `lx-im`;
create table `user`( create table `im_user`(
`id` bigint not null auto_increment primary key comment 'id', `id` bigint not null auto_increment primary key comment 'id',
`user_name` varchar(255) not null comment '用户名', `user_name` varchar(255) not null comment '用户名',
`nick_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) key `idx_nick_name`(nick_name)
) ENGINE=InnoDB CHARSET=utf8mb3 comment '用户'; ) ENGINE=InnoDB CHARSET=utf8mb3 comment '用户';
create table `friends`( create table `im_friends`(
`id` bigint not null auto_increment primary key comment 'id', `id` bigint not null auto_increment primary key comment 'id',
`user_id` bigint not null comment '用户id', `user_id` bigint not null comment '用户id',
`friend_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`) key `idx_friend_id` (`friend_id`)
) ENGINE=InnoDB CHARSET=utf8mb3 comment '好友'; ) ENGINE=InnoDB CHARSET=utf8mb3 comment '好友';
create table `single_message`( create table `im_single_message`(
`id` bigint not null auto_increment primary key comment 'id', `id` bigint not null auto_increment primary key comment 'id',
`send_user_id` bigint not null comment '发送用户id', `send_user_id` bigint not null comment '发送用户id',
`recv_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 '私聊消息'; )ENGINE=InnoDB CHARSET=utf8mb3 comment '私聊消息';
create table `group`( create table `im_group`(
`id` bigint not null auto_increment primary key comment 'id', `id` bigint not null auto_increment primary key comment 'id',
`name` varchar(255) not null comment '群名字', `name` varchar(255) not null comment '群名字',
`owner_id` bigint not null comment '群主id', `owner_id` bigint not null comment '群主id',
`head_image` varchar(255) default '' comment '群头像', `head_image` varchar(255) default '' comment '群头像',
`head_image_thumb` varchar(255) default '' comment '群头像缩略图', `head_image_thumb` varchar(255) default '' comment '群头像缩略图',
`notice` text comment '群公告', `notice` varchar(1024) default '' comment '群公告',
`remark` varchar(255) default '' comment '群备注', `remark` varchar(255) default '' comment '群备注',
`created_time` datetime DEFAULT CURRENT_TIMESTAMP 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', `id` bigint not null auto_increment primary key comment 'id',
`group_id` bigint not null comment '群id', `group_id` bigint not null comment '群id',
`user_id` bigint not null comment '用户id', `user_id` bigint not null comment '用户id',
`alias_name` varchar(255) DEFAULT '' comment '组内显示名称', `alias_name` varchar(255) DEFAULT '' comment '组内显示名称',
`head_image` 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 '创建时间', `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
key `idx_group_id`(`group_id`), key `idx_group_id`(`group_id`),
key `idx_user_id`(`user_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', `id` bigint not null auto_increment primary key comment 'id',
`group_id` bigint not null comment '群id', `group_id` bigint not null comment '群id',
`send_user_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 '群消息'; )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', `id` bigint not null auto_increment primary key comment 'id',
`group_id` bigint not null comment '群id', `group_id` bigint not null comment '群id',
`user_id` bigint not null comment '用户id', `user_id` bigint not null comment '用户id',

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

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

2
im-ui/src/store/friendsStore.js

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

23
im-ui/src/view/Friends.vue

@ -1,18 +1,14 @@
<template> <template>
<el-container> <el-container>
<el-aside width="250px" class="l-friend-box"> <el-aside width="250px" class="l-friend-box">
<el-header height="60px"> <el-header class="l-friend-header" height="60px">
<el-row> <div class="l-friend-search">
<el-col :span="19">
<el-input width="200px" placeholder="搜索好友" v-model="searchText"> <el-input width="200px" placeholder="搜索好友" v-model="searchText">
<el-button slot="append" icon="el-icon-search"></el-button> <el-button slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
</el-col> </div>
<el-col :span="1"></el-col> <el-button plain icon="el-icon-plus" style="border: none; padding:12px; font-size: 20px;color: black;" title="添加好友" @click="onShowAddFriends"></el-button>
<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>
<add-friends :dialogVisible="showAddFriend" @close="onCloseAddFriends" @add="onAddFriend()"> <add-friends :dialogVisible="showAddFriend" @close="onCloseAddFriends" @add="onAddFriend()">
</add-friends> </add-friends>
</el-header> </el-header>
@ -134,10 +130,15 @@
border: #dddddd solid 1px; border: #dddddd solid 1px;
background: #eeeeee; background: #eeeeee;
.el-header { .l-friend-header {
display: flex;
align-items: center;
padding: 5px; padding: 5px;
background-color: white; background-color: white;
line-height: 50px;
.l-friend-search{
flex: 1;
}
} }
.el-main { .el-main {

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

@ -16,6 +16,12 @@
<span class="el-icon-user"></span> <span class="el-icon-user"></span>
</router-link> </router-link>
</el-menu-item> </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()" > <el-menu-item title="设置" @click="onClickSetting()" >
<span class="el-icon-setting"></span> <span class="el-icon-setting"></span>
</el-menu-item> </el-menu-item>

Loading…
Cancel
Save