feat(note): add audio upload and sharing functionality

- Introduced `note_audio` table for storing audio attachments related to notes.
- Implemented audio upload endpoint in `Note` controller to handle audio file uploads.
- Added sharing functionality with `note_share` table to manage share tokens and view counts.
- Updated API routes to include endpoints for audio uploads and share creation.
- Enhanced documentation to reflect new audio and sharing features.
This commit is contained in:
nepiedg
2026-04-17 10:33:33 +00:00
parent 84e1c0daac
commit 36c506f4bf
15 changed files with 507 additions and 8 deletions
+35
View File
@@ -103,3 +103,38 @@ CREATE TABLE IF NOT EXISTS `note_ai_summary` (
KEY `idx_status` (`status`),
KEY `idx_summary_type` (`summary_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='note模块-AI总结结果表';
-- 笔记录音附件表
CREATE TABLE IF NOT EXISTS `note_audio` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`note_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'note_item.id',
`disk` varchar(30) NOT NULL DEFAULT 'public' COMMENT '存储磁盘',
`file_path` varchar(255) NOT NULL DEFAULT '' COMMENT '磁盘相对路径',
`file_url` varchar(500) NOT NULL DEFAULT '' COMMENT '公开访问地址',
`file_size` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件大小',
`mime_type` varchar(100) NOT NULL DEFAULT '' COMMENT '文件类型',
`duration_ms` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '录音时长',
`created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_note_id` (`note_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='note模块-录音附件表';
-- 笔记分享表
CREATE TABLE IF NOT EXISTS `note_share` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`note_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'note_item.id',
`note_user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'note_user.id',
`share_token` varchar(64) NOT NULL DEFAULT '' COMMENT '分享 token',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '分享标题',
`view_count` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '查看次数',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0失效 1有效',
`expired_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间,0不过期',
`last_view_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后查看时间',
`created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_share_token` (`share_token`),
KEY `idx_note_id` (`note_id`),
KEY `idx_note_user_id` (`note_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='note模块-分享记录表';