上传文件至 /

This commit is contained in:
西街长安 2025-10-12 19:51:16 +08:00
parent 5afe42c1aa
commit bfdef592fd
2 changed files with 267 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/28.1.2 Chrome/138.0.7204.243 Electron/37.4.0 Safari/537.36" version="28.1.2">
<diagram name="第 1 页" id="2fKKEPSov5MZ28Ksnagn">
<mxGraphModel dx="1042" dy="1434" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<mxGraphModel dx="1028" dy="1419" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
@ -539,9 +539,6 @@
<mxCell id="LqGEv66xggxL4AquUroI-140" value="对方ID" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="90" y="-290" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-141" value="消息类型" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="200" y="-290" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-142" value="最后一条消息ID" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="320" y="-290" width="90" height="50" as="geometry" />
</mxCell>
@ -566,12 +563,6 @@
<mxPoint x="135" y="-169.28932188134524" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-149" value="" style="endArrow=none;html=1;rounded=0;" parent="1" source="LqGEv66xggxL4AquUroI-141" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="245" y="-190" as="sourcePoint" />
<mxPoint x="245" y="-169.28932188134524" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-150" value="" style="endArrow=none;html=1;rounded=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" parent="1" source="LqGEv66xggxL4AquUroI-142" target="LqGEv66xggxL4AquUroI-56" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="365" y="-190" as="sourcePoint" />
@ -639,7 +630,7 @@
<mxGeometry x="1210" y="530" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-170" value="通知内容" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1360" y="510" width="90" height="50" as="geometry" />
<mxGeometry x="1440" y="500" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-171" value="创建时间" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1460" y="430" width="90" height="50" as="geometry" />
@ -1031,18 +1022,63 @@
<mxPoint x="840" y="1530.7106781186549" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LqGEv66xggxL4AquUroI-257" value="n" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="685" y="1528" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="rbyy9AzwD7G3afUYTR2a-1" value="申请时间" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="rbyy9AzwD7G3afUYTR2a-1" value="申请时间" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="850" y="-190" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="rbyy9AzwD7G3afUYTR2a-2" value="" style="endArrow=none;html=1;rounded=0;entryX=0.036;entryY=0.68;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" target="rbyy9AzwD7G3afUYTR2a-1">
<mxCell id="rbyy9AzwD7G3afUYTR2a-2" value="" style="endArrow=none;html=1;rounded=0;entryX=0.036;entryY=0.68;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="rbyy9AzwD7G3afUYTR2a-1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="800" y="-150" as="sourcePoint" />
<mxPoint x="860" y="-180" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-1" value="邀请时间" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="400" y="960" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-2" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=1;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="LqGEv66xggxL4AquUroI-74" target="LlkoEB-2TC3n23V2uSJG-1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="370" y="1070" as="sourcePoint" />
<mxPoint x="420" y="1020" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-3" value="通知标题" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="1330" y="540" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-4" value="" style="endArrow=none;html=1;rounded=0;entryX=0.75;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="LlkoEB-2TC3n23V2uSJG-3" target="LqGEv66xggxL4AquUroI-63">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1320" y="510" as="sourcePoint" />
<mxPoint x="1370" y="460" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-5" value="角色权限关联表" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#1ba1e2;fontColor=#ffffff;strokeColor=#006EAF;" vertex="1" parent="1">
<mxGeometry x="230" y="1910" width="100" height="60" as="geometry" />
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-6" value="唯一ID" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="140" y="1800" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-7" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="LlkoEB-2TC3n23V2uSJG-5" target="LlkoEB-2TC3n23V2uSJG-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="210" y="1920" as="sourcePoint" />
<mxPoint x="260" y="1870" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-8" value="权限ID" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="260" y="1810" width="90" height="50" as="geometry" />
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-9" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="LlkoEB-2TC3n23V2uSJG-5" target="LlkoEB-2TC3n23V2uSJG-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="240" y="1920" as="sourcePoint" />
<mxPoint x="290" y="1870" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-10" value="" style="endArrow=none;html=1;rounded=0;exitX=1.084;exitY=0.39;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="LlkoEB-2TC3n23V2uSJG-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="1930" as="sourcePoint" />
<mxPoint x="370" y="1920" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlkoEB-2TC3n23V2uSJG-11" value="角色ID" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="370" y="1890" width="90" height="50" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>

215
数据字典.md Normal file
View File

@ -0,0 +1,215 @@
# 数据字典
### 表名Users
#### 表说明:储存用户个人信息
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ----------- | ----------- | -------- | -------- | ------- | --------- | ------------------------------------------------ | --------- |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| Username | VARCHAR(50) | 是 | / | / | 唯一 | 唯一用户名 | admin |
| Password | VARCHAR(50) | 是 | / | / | / | 用户密码 | 123456 |
| OlineStatus | TINYINT | 是 | 0 | / | / | 用户在线状态<br />0默认不在线<br />1在线 | 0 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 账户创建时间 | 2025/9/29 |
| Updated | DATETIME | 否 | / | / | / | 账户修改时间 | 2024/9/29 |
| Status | TINYINT | 是 | 1 | / | / | 账户状态<br />(0未激活,1正常,2封禁) | 1 |
| IsDeleted | TINYINT | 是 | 0 | / | / | 软删除标识<br />0账号正常<br />1账号已删除 | 0 |
### 表名Friends
#### 表说明:好友关系映射
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| -------- | -------- | -------- | -------- | ---------------- | --------- | ------------------------------------------------------------ | --------- |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| UserId | INT | 是 | / | 外键Users.Id | 索引 | 用户ID | 1 |
| FriendId | INT | 是 | / | 外键Users.Id | 索引 | 用户2ID | 2 |
| Status | TINYINT | 是 | 0 | / | / | 当前好友关系状态<br />0待通过,1已添加,2已拒绝,3已拉黑 | 0 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 好友关系创建时间 | 2025/9/29 |
### 表名Groups
#### 表说明:群聊
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ---------------- | ------------- | -------- | -------- | ---------------- | --------- | ------------------------------------------------------------ | ------------------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| Name | VARCHAT20 | 是 | / | / | / | 群聊名称 | 测试群聊1 |
| GroupMaster | INT | 是 | / | 外键Users.Id | 索引 | 群主 | 1 |
| Auhority | TINYINT | 是 | 0 | / | / | 群权限<br />0需管理员同意,1任意人可加群,2不允许任何人加入 | 0 |
| AllMembersBanned | TINYINT | 是 | 0 | / | / | 全员禁言0允许发言2全员禁言 | 0 |
| Status | TINYINT | 是 | 1 | / | / | 群聊状态<br />(1正常,2封禁) | 1 |
| Announcement | TEXT | 否 | null | / | / | 群公告 | 这是一条测试群公告 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 群聊创建时间 | 2025/9/29 |
### 表名GroupMember
#### 表说明:群成员
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------- | -------- | -------- | -------- | --------------- | --------- | -------------------------------------- | -------- |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| UserId | INT | 是 | / | 外键(Users.Id) | 索引 | 用户编号 | 1 |
| GroupId | INT | 是 | / | 外键(Groups.Id) | 索引 | 群聊编号 | 1 |
| Role | TINYINT | 是 | 0 | / | / | 成员角色0:普通成员,1:管理员,2:群主) | 1 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 加入群聊时间 | 1970/1/1 |
### 表名GroupInvite
#### 表说明:群聊邀请
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ----------- | -------- | -------- | -------- | --------------- | --------- | ------------------------------------------------ | -------- |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| GroupId | INT | 是 | / | 外键(Groups.Id) | 索引 | 群聊编号 | 1 |
| InvitedUser | INT | 是 | / | 外键(Users.Id) | 索引 | 被邀请用户 | 1 |
| InviteUser | INT | 是 | / | 外键(Users.Id) | 索引 | 邀请用户 | 1 |
| State | TINYINT | 是 | 0 | / | / | 当前状态(0:待被邀请人同意<br />1:被邀请人已同意) | 1 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | 1970/1/1 |
### 表名GroupRequest
#### 表说明:群聊入群申请
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ----------- | -------- | -------- | --------------- | --------------- | --------- | --------------------------------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| GroupId | INT | 是 | / | 外键(Groups.Id) | 索引 | 群聊编号 | 1 |
| UserId | INT | 是 | / | 外键(Users.Id) | 索引 | 申请人 | 1 |
| State | TINYINT | 是 | 0 | / | / | 申请状态0:待管理员同意,1:已拒绝,2已同意 | 1 |
| Description | TEXT | 是 | xxx申请加入群聊 | / | / | 入群附言 | / |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | / |
### 表名Messages
#### 表说明:用户消息
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| -------- | -------- | -------- | ------ | ------- | --------- | ------------------------------------------------------------ | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| ChatType | TINYINT | 是 | 0 | / | / | 聊天类型<br />0私聊,1群聊 | 0 |
| MsgType | TINYINT | 是 | 0 | / | / | 消息类型<br />(0:文本,1图片,2语音,3视频,4文件5语音聊天,6视频聊天) | 0 |
| Content | TEXT | 否 | / | | | | |
### 表名Files
#### 表说明:文件
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| --------- | ------------ | -------- | -------- | ------------------- | --------- | -------------------- | ----------------------- |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| Name | VARCHAR(50) | 是 | / | / | / | 文件名 | 测试文件.txt |
| URL | VARCHAR(100) | 是 | / | / | / | 文件储存URL | https://baidu.com/1.txt |
| Size | INT | 是 | / | / | / | 文件大小单位KB | 1024 |
| Type | VARCHAT(10) | 是 | / | / | / | 文件类型 | txt |
| MessageId | INT | 是 | / | 外键Messages.Id | 索引 | 关联消息ID | 1 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | 2025/9/29 |
### 表名Notifications
#### 表说明:系统通知消息
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------- | ------------ | -------- | -------- | -------------- | --------- | ------------------------ | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| UserId | INT | 否 | / | 外键(Users.Id) | 索引 | 接收人(为空为全体通知) | 1 |
| NType | TINYINT | 是 | 0 | / | / | 通知类型(0文本) | 0 |
| Title | NVARCHAR(20) | 是 | / | / | / | 通知标题 | 1 |
| Content | TEXT | 是 | / | / | / | 通知内容 | 1 |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | / |
### 表名Conversations
#### 表说明:用户会话
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------------- | -------- | -------- | ------ | ----------------- | --------- | ------------------------------------ | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| UserId | INT | 是 | / | 外键(Users.Id) | 索引 | 用户 | 1 |
| TargetId | INT | 是 | / | / | / | 对方ID群聊为群聊ID单聊为单聊ID | 1 |
| MsgType | INT | 是 | / | / | / | 消息类型同Messages.MsgType | / |
| lastMessageId | INT | 是 | / | 外键(Messages.Id) | 索引 | 最后一条消息ID | 1 |
| unreadCount | INT | 是 | / | / | / | 未读消息数 | / |
### 表名FriendRequest
#### 表说明:好友申请
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------------ | -------- | -------- | ------------------- | ---------------- | --------- | ------------------------------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| RequestUser | INT | 是 | / | 外键(Users.Id) | 索引 | 申请人 | / |
| ResponseUser | INT | 是 | / | 外键Users.Id | 索引 | 被申请人 | / |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 申请时间 | / |
| Description | TEXT | 否 | xxx申请添加你为好友 | / | / | 申请附言 | / |
| State | TINYINT | 是 | 0 | / | / | 申请状态0待通过,1:拒绝,2:同意,3拉黑 | / |
### 表名Devices
#### 表说明:用户设备
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| --------- | -------- | -------- | -------- | -------------- | --------- | ---------------------------------------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| UserId | INT | 是 | / | 外键(Users.Id) | 索引 | 设备所属用户 | / |
| DType | TINYINT | 是 | / | / | / | 设备类型(<br />0:Android,1:Ios,2:PC,3Pad,4:未知) | 0 |
| LastLogin | DATETIME | 是 | 1970/1/1 | / | / | 最后一次登录 | / |
### 表名Login_Log
#### 表说明:登录日志
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------- | -------- | -------- | -------- | -------------- | --------- | ---------------------------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| DType | TINYINT | 是 | / | / | / | 设备类型通Devices/DType | / |
| Logined | DATETIME | 是 | 1970/1/1 | / | / | 登录时间 | / |
| UserId | INT | 是 | / | 外键(Users.Id) | / | 登录用户 | / |
| State | TINYINT | 是 | 0 | / | / | 登录状态(0:登陆成功,1:未验证,2:已被拒绝) | / |
### 表名Admins
#### 表说明:系统管理员
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| -------- | ----------- | -------- | -------- | ---------------- | --------- | ----------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| Username | VARCHAR(50) | 是 | / | / | / | 用户名 | / |
| Password | VARCHAR(50) | 是 | / | / | / | 密码 | / |
| RoleId | INT | 是 | / | 外键Roles.Id | 索引 | 角色 | / |
| State | TINYINT | 是 | 0 | / | / | 状态0:正常2封禁 | / |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | / |
| Updated | DATETIME | 是 | 1970/1/1 | / | / | 更新时间 | / |
### 表名Roles
#### 表说明:角色
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ----------- | ----------- | -------- | -------- | ------- | --------- | -------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| Name | VARCHAR(20) | 是 | / | / | / | 角色名称 | / |
| Description | TEXT | 是 | 空字符串 | / | / | 角色描述 | / |
| Created | DATETIME | 是 | 1970/1/1 | / | / | 创建时间 | / |
### 表名Permissions
#### 表说明:权限
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------- | ----------- | -------- | ------ | ------- | --------- | ----------------------------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| PType | INT | 是 | 0 | / | / | 权限类型(0:增,1:删,2:改,3:查) | / |
| Name | VARCHAR(50) | 是 | / | / | / | 权限名称 | / |
| Code | INT | 是 | / | / | / | 权限编码 | / |
| Created | DATETIME | 是 | / | / | / | 创建时间 | / |
### 表名PermissionARole
#### 表说明:权限角色关联
| 字段名 | 数据类型 | 是否必填 | 默认值 | 主/外键 | 约束/索引 | 字段说明 | 示例值 |
| ------------ | -------- | -------- | ------ | ---------------------- | --------- | -------- | ------ |
| Id | INT | 是 | / | 主键 | 索引 | 主键自增 | 1 |
| RoleId | INT | 是 | / | 外键Roles.Id | 索引 | 角色 | / |
| PermissionId | INT | 是 | / | 外键Permissions.Id | 索引 | 权限 | / |