fix problems
All checks were successful
Xiaoshiliu / build (push) Successful in 4m56s

This commit is contained in:
lychang
2025-10-04 09:45:32 +08:00
parent 58a50b6e9e
commit b7906446d3
10 changed files with 27 additions and 27 deletions

View File

@@ -1854,7 +1854,7 @@ Authorization: Bearer <your_jwt_token>
- 使用 `multipart/form-data` 格式
- 文件字段名: `file`
- 支持格式: jpg, jpeg, png, webp
- 文件大小限制: 5MB
- 文件大小限制: 150MB
**响应示例**:
```json
@@ -1878,7 +1878,7 @@ Authorization: Bearer <your_jwt_token>
- 文件字段名: `files`
- 最多支持9个文件
- 支持格式: jpg, jpeg, png, webp
- 单文件大小限制: 5MB
- 单文件大小限制: 150MB
**响应示例**:
```json
@@ -2483,7 +2483,7 @@ async function example() {
1. **认证要求**: 需要认证的接口必须在请求头中携带有效的JWT token
2. **Token管理**: 访问令牌有效期为1小时刷新令牌有效期为7天
3. **请求格式**: 所有POST/PUT请求需要设置`Content-Type: application/json`(文件上传除外)
4. **图片上传**: 图片上传接口使用`multipart/form-data`格式支持jpg、jpeg、png、gif、webp格式单图片最大5MB
4. **图片上传**: 图片上传接口使用`multipart/form-data`格式支持jpg、jpeg、png、gif、webp格式单图片最大150MB
5. **状态切换**: 点赞、收藏、关注等操作支持切换状态(已点赞则取消点赞)
6. **自动更新**: 访问笔记详情会自动增加浏览量,创建评论会自动更新笔记的评论数
7. **关系更新**: 关注操作会自动更新用户的关注数和粉丝数

View File

@@ -1538,7 +1538,7 @@ General parameters for interfaces that support pagination:
- Use `multipart/form-data` format
- File field name: `file`
- Supported formats: jpg, jpeg, png, webp
- File size limit: 5MB
- File size limit: 150MB
**Response Example**:
```json
@@ -1562,7 +1562,7 @@ General parameters for interfaces that support pagination:
- File field name: `files`
- Up to 9 files supported
- Supported formats: jpg, jpeg, png, webp
- Single file size limit: 5MB
- Single file size limit: 150MB
**Response Example**:
```json
@@ -2144,7 +2144,7 @@ async function example() {
2. **Token Management**: The validity period for token access is 1 hour, and the validity period for refresh tokens is 7 days.
3. **Request Format**: All POST/PUT requests need to set `Content-Type: application/json` (except for file upload).
4. **Image Upload**: The image upload interface uses the `multipart/form-data` format, supporting jpg, jpeg, png, gif, and webp formats, with a maximum file size of 5MB for a single image.
4. **Image Upload**: The image upload interface uses the `multipart/form-data` format, supporting jpg, jpeg, png, gif, and webp formats, with a maximum file size of 150MB for a single image.
5. **Status Switching**: Operations such as liking, favoriting, and following support status switching (canceling a like if already liked).
6. **Automatic Update**: Visiting note details will automatically increase the number of views, and creating comments will automatically update the number of comments on the note.
7. **Relationship Update**: The follow operation will automatically update the user's number of followers and fans.

View File

@@ -1728,7 +1728,7 @@ Authorization: Bearer <your_jwt_token>
- 使用 `multipart/form-data` 格式
- 文件字段名: `file`
- 支持格式: jpg, jpeg, png, webp
- 文件大小限制: 5MB
- 文件大小限制: 150MB
**響應範例**:
```json
@@ -1752,7 +1752,7 @@ Authorization: Bearer <your_jwt_token>
- 文件欄位名: `files`
- 最多支持9個文件
- 支持格式: jpg, jpeg, png, webp
- 单文件大小限制: 5MB
- 单文件大小限制: 150MB
**回應範例**:
```json
@@ -2324,7 +2324,7 @@ async function example() {
1. **認證要求**: 需要認證的接口必须在請求頭中攜帶有效的JWT token
2. **Token管理**: 存取令牌有效期为1小時刷新令牌有效期为7天
3. **請求格式**: 所有POST/PUT請求需要設置`Content-Type: application/json`(文件上傳除外)
4. **圖片上傳**: 圖片上傳接口使用`multipart/form-data`格式支持jpg、jpeg、png、gif、webp格式單圖片最大5MB
4. **圖片上傳**: 圖片上傳接口使用`multipart/form-data`格式支持jpg、jpeg、png、gif、webp格式單圖片最大150MB
5. **狀態切換**: 按讚、收藏、關注等操作支持切換狀態(已按讚則取消按讚)
6. **自動更新**: 访問筆記詳情會自動增加瀏覽量,創建評論會自動更新筆記的評論數
7. **關係更新**: 關注操作會自動更新用戶的關注數和粉絲數

View File

@@ -34,7 +34,7 @@ const upload = multer({
storage: storage,
fileFilter: imageFileFilter,
limits: {
fileSize: 5 * 1024 * 1024 // 5MB 限制
fileSize: 150 * 1024 * 1024 // 5MB 限制
}
});
@@ -256,7 +256,7 @@ router.post('/video', authenticateToken, videoUpload.fields([
router.use((error, req, res, next) => {
if (error instanceof multer.MulterError) {
if (error.code === 'LIMIT_FILE_SIZE') {
return res.status(HTTP_STATUS.BAD_REQUEST).json({ code: RESPONSE_CODES.VALIDATION_ERROR, message: '文件大小超过限制(5MB' });
return res.status(HTTP_STATUS.BAD_REQUEST).json({ code: RESPONSE_CODES.VALIDATION_ERROR, message: '文件大小超过限制(150MB' });
}
if (error.code === 'LIMIT_FILE_COUNT') {
return res.status(HTTP_STATUS.BAD_REQUEST).json({ code: RESPONSE_CODES.VALIDATION_ERROR, message: '文件数量超过限制9个' });

View File

@@ -48,7 +48,7 @@ export async function uploadImage(file, options = {}) {
try {
if (!file) throw new Error('请选择要上传的文件')
if (file instanceof File && !file.type.startsWith('image/')) throw new Error('请选择图片文件')
if (file.size > 5 * 1024 * 1024) throw new Error('图片大小不能超过5MB')
if (file.size > 150 * 1024 * 1024) throw new Error('图片大小不能超过150MB')
// 压缩图片
const compressedFile = await compressImage(file)
@@ -208,7 +208,7 @@ export async function uploadCroppedImage(blob, options = {}) {
export function validateImageFile(file, options = {}) {
const {
maxSize = 5 * 1024 * 1024,
maxSize = 150 * 1024 * 1024,
allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp']
} = options

View File

@@ -47,7 +47,7 @@
<div class="upload-tips">
<p> 最多上传{{ maxImages }}张图片</p>
<p> 支持 JPGPNG 格式</p>
<p> 单张图片不超过5MB</p>
<p> 单张图片不超过150MB</p>
<p class="drag-tip"> <span class="desktop-tip">拖拽图片可调整顺序</span><span class="mobile-tip">长按图片可拖拽排序</span></p>
</div>
@@ -208,9 +208,9 @@ const addFiles = async (files) => {
// 验证所有文件
for (const file of fileArray) {
// 先检查文件大小
if (file.size > 5 * 1024 * 1024) {
if (file.size > 150 * 1024 * 1024) {
const fileSizeMB = (file.size / (1024 * 1024)).toFixed(1)
const errorMsg = `图片大小为 ${fileSizeMB}MB超过 5MB 限制,请选择更小的图片`
const errorMsg = `图片大小为 ${fileSizeMB}MB超过 150MB 限制,请选择更小的图片`
// 显示Toast提示
showMessage(errorMsg, 'error')

View File

@@ -210,8 +210,8 @@ const validateCoverFile = (file) => {
return { valid: false, message: '请选择图片文件' }
}
// 验证文件大小 (5MB)
const maxCoverSize = 5 * 1024 * 1024
// 验证文件大小 (150MB)
const maxCoverSize = 150 * 1024 * 1024
if (file.size > maxCoverSize) {
return { valid: false, message: `封面图片大小不能超过${formatFileSize(maxCoverSize)}` }
}

View File

@@ -54,7 +54,7 @@
<div class="upload-tips">
<p> 最多上传{{ maxImages }}张图片已确认{{ confirmedImages.length }}</p>
<p> 支持 JPGPNG 格式</p>
<p> 单张图片不超过5MB</p>
<p> 单张图片不超过150MB</p>
<p> 长按图片可拖拽排序</p>
<p v-if="localImages.length > 0"> 当前选择{{ localImages.length }}点击确认上传后才会显示在预览区域</p>
</div>
@@ -174,9 +174,9 @@ const processFiles = async (files) => {
continue
}
// 检查文件大小 (5MB)
if (file.size > 5 * 1024 * 1024) {
error.value = '图片大小不能超过5MB'
// 检查文件大小 (150MB)
if (file.size > 150 * 1024 * 1024) {
error.value = '图片大小不能超过150MB'
continue
}

View File

@@ -1234,7 +1234,7 @@ const apiGroups = ref([
method: 'POST',
path: '/api/upload/single',
title: '单图片上传',
description: '上传单个图片文件,限制5MB',
description: '上传单个图片文件,限制150MB',
auth: true,
expanded: false,
params: [
@@ -1254,7 +1254,7 @@ const apiGroups = ref([
method: 'POST',
path: '/api/upload/multiple',
title: '多图片上传',
description: '上传多个图片文件最多9个每个限制5MB',
description: '上传多个图片文件最多9个每个限制150MB',
auth: true,
expanded: false,
params: [

View File

@@ -375,7 +375,7 @@ const handleDrop = (event) => {
const validateFile = (file) => {
const validTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
const maxSize = 5 * 1024 * 1024
const maxSize = 150 * 1024 * 1024
if (!validTypes.includes(file.type)) {
const errorMsg = '不填有效的图片格式 (JPEG, PNG, GIF, WebP)'
@@ -386,9 +386,9 @@ const validateFile = (file) => {
if (file.size > maxSize) {
const fileSizeMB = (file.size / (1024 * 1024)).toFixed(1)
const errorMsg = `图片大小为 ${fileSizeMB}MB超过 5MB 限制,不填更小的图片`
const errorMsg = `图片大小为 ${fileSizeMB}MB超过 150MB 限制,不填更小的图片`
avatarError.value = '图片大小不能超过 5MB'
avatarError.value = '图片大小不能超过 150MB'
$message.error(errorMsg)
return false
}