refactor: 优化站内信及消息管理

1.新增站内信未读消息轮询
2.优化消息管理 API,移除部分无用 API
3.优化部分代码格式
This commit is contained in:
2023-11-03 23:25:04 +08:00
parent 28f4791833
commit d41e01c388
32 changed files with 547 additions and 468 deletions

View File

@@ -7,14 +7,3 @@ INSERT IGNORE INTO `sys_menu`
VALUES
(1060, '消息管理', 1000, 2, '/system/message', 'Message', 'system/message/index', 'notification', b'0', b'0', b'0', 'system:message:list', 6, 1, 1, NOW(), NULL, NULL),
(1061, '消息删除', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:message:delete', 1, 1, 1, NOW(), NULL, NULL);
-- 初始化默认字典
INSERT IGNORE INTO `sys_dict`
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES
(2, '消息类型', 'message_type', NULL, b'1', 1, NOW(), NULL, NULL);
INSERT IGNORE INTO `sys_dict_item`
(`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES
(3, '系统消息', '1', 'blue', 1, NULL, 2, 1, NOW(), NULL, NULL);

View File

@@ -13,19 +13,19 @@ CREATE TABLE IF NOT EXISTS `sys_user_social` (
-- changeset BUSS_BCLS:2
CREATE TABLE IF NOT EXISTS `sys_message` (
`id` bigint(20) AUTO_INCREMENT COMMENT 'ID',
`title` varchar(50) NOT NULL COMMENT '',
`content` varchar(255) DEFAULT NULL COMMENT '内容',
`type` varchar(30) NOT NULL COMMENT '类型',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`id` bigint(20) AUTO_INCREMENT COMMENT 'ID',
`title` varchar(50) NOT NULL COMMENT '',
`content` varchar(255) DEFAULT NULL COMMENT '内容',
`type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '类型1系统消息',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息表';
CREATE TABLE IF NOT EXISTS `sys_message_user` (
`message_id` bigint(20) NOT NULL COMMENT '消息ID',
`user_id` bigint(11) NOT NULL COMMENT '用户ID',
`read_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已读',
`read_time` datetime DEFAULT NULL COMMENT '读取时间',
`message_id` bigint(20) NOT NULL COMMENT '消息ID',
`user_id` bigint(11) NOT NULL COMMENT '用户ID',
`is_read` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已读',
`read_time` datetime DEFAULT NULL COMMENT '读取时间',
PRIMARY KEY (`message_id`,`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息和用户关联表';