diff --git a/src/utils/request.js b/src/utils/request.js index 4224b809686aa733bb9dcb4550b5eba3e96058f3..388237a4ec4da98b220ddf7018e59ce5e59b328d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -11,8 +11,8 @@ const service = axios.create({ baseURL: process.env.BASE_API, // 在跨域请求时发送cookie withCredentials: true, - // 请求超时1分钟(单位:毫秒) - timeout: 300000000 + // 请求超时5分钟(单位:毫秒) + timeout: 300000 }) // 请求拦截器 diff --git a/src/views/setting/setting.vue b/src/views/setting/setting.vue index 9d41fef8370dea1f88fcfd4228d14454cb5a48af..e1c9eb1536c74d597f6ceb5e907e97bf60d6ded4 100644 --- a/src/views/setting/setting.vue +++ b/src/views/setting/setting.vue @@ -603,7 +603,8 @@ export default { userId: this.userInfo.userId } params[key] = value - if (this.paymentOrderSearchForm.time !== '' && + if (this.paymentOrderSearchForm.time !== null && + this.paymentOrderSearchForm.time !== '' && this.paymentOrderSearchForm.time[0] !== undefined && this.paymentOrderSearchForm.time[1] !== undefined) { params.startTime = this.paymentOrderSearchForm.time[0] @@ -660,7 +661,7 @@ export default { } res['effectiveDuration'] = effectiveDuration res['orderTotalAmount'] = `¥${res['orderTotalAmount'] / 100}` - // 支付方式: 1:微信 2:支付宝 + // 支付方式: 1:微信 2:支付宝 3:系统赠送 res['orderPaymentType'] = this.formattingOrderPaymentType(res['orderPaymentType']) res['success'] = this.formattingOrderTradeState(res['orderTradeState']) if (res['orderSuccessTime'] === null || res['orderSuccessTime'] === undefined) { @@ -699,16 +700,18 @@ export default { /** * 格式化订单支付类型 * 当前已定义的支付类型为 - * 1:微信 2:支付宝 + * 1:微信 2:支付宝 3:系统赠送 * @param paymentType 支付类型枚举 */ formattingOrderPaymentType: function (paymentType) { - // 支付方式: 1:微信 2:支付宝 + // 支付方式: 1:微信 2:支付宝 3:系统赠送 switch (paymentType) { case '1': return '微信' case '2': return '支付宝' + case '3': + return '赠送' default: return '未定义' } diff --git "a/\345\205\234\345\205\234\347\275\221\347\233\230API\346\226\207\346\241\243.md" "b/\345\205\234\345\205\234\347\275\221\347\233\230API\346\226\207\346\241\243.md" index 496e867b88a022fae214f218254a6c1dbb87ee76..2398c7e6ffd76782a207fa48877dd665efcd1696 100644 --- "a/\345\205\234\345\205\234\347\275\221\347\233\230API\346\226\207\346\241\243.md" +++ "b/\345\205\234\345\205\234\347\275\221\347\233\230API\346\226\207\346\241\243.md" @@ -15,6 +15,10 @@ [TOC] # 更新记录 +## 2021 年 10 月 24 日 +
更新了用户鉴权方式,新增鉴权请求头Authorization,同时兼容原有Cookie请求头
+新增指定文件标识批量查找文件接口
+更新了资源下载链接默认有效时长
## 2021 年 9 月 20 日新建文件夹请求参数变更
@@ -43,11 +47,12 @@ |O|任意可选|包含任意可选与条件可选,可以不携带,或不反回| |C|条件可选|| -## 接口基本消息参数 +## 接口基本请求头参数 | 参数名称 | 说明 | 例子 | | -------- | -------- | -------- | -|Cookie|携带用户鉴权信息(登陆时获取)获取文件上传所需token,是前端请求七牛云上传必传项
也是根据此接口进行文件的创建操作
最大可上传20GB的文件
+需要注意的是此接口响应正常的情况下会返回200或者201两种状态码
+code: 200 (需要根据响应结果中指定的token、key进行七牛文件上传的操作)
+code: 201 (完成秒传操作,不会返回token、key,直接走上传成功后的操作即可)
+ **请求参数**: @@ -660,7 +669,7 @@ Content-Type: image/jpeg ```json { - "code": "", + "code": "200", "data": { "diskUserFile": { "createTime": "", @@ -680,10 +689,17 @@ Content-Type: image/jpeg "key": "", "token": "" }, - "message": "" + "message": "请求成功" } ``` +**响应状态**: + +| 状态码 | 说明 | +| -------- | -------- | +|200|请求成功,会返回指定上传token、key| +|201|秒传| + **请求示例**: ```http request @@ -691,7 +707,7 @@ POST /uploader/token HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "ossFileEtag": "", @@ -746,7 +762,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 ```json { - "code": "", + "code": "200", "data": { "createTime": "", "fileFolder": true, @@ -762,7 +778,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 "userFileParentId": "", "userId": 0 }, - "message": "" + "message": "请求成功" } ``` @@ -773,7 +789,7 @@ POST /disk-file/insert-file-folder HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "userFileName": "", @@ -826,7 +842,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 ```json { - "code": "", + "code": "200", "data": { "createTime": "", "fileFolder": true, @@ -842,7 +858,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 "userFileParentId": "", "userId": 0 }, - "message": "" + "message": "请求成功" } ``` @@ -852,7 +868,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 POST /disk-file/rename-file?newUserFileName=&userFileId= HTTP/1.1 Host: cloud.api.novelweb.cn -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 ``` ## 资源文件下载 @@ -866,9 +882,9 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 **响应数据类型**:`application/json;charset=UTF-8` **接口描述**: -获取文件的临时访问Url,最多可以生成有效时长为12小时的动态链接
+获取文件的临时访问Url,最多可以生成有效时长为5小时的动态链接
需要注意的是,此接口如果响应成功,会进行302跳转,跳转的地址为动态生成的资源访问地址
-资源访问地址有效时长默认为6小时
+资源访问地址有效时长默认为3小时
**请求参数**: @@ -879,7 +895,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 |preview|是否获取用于预览的链接|O|boolean| |shareKey|文件的key值(分享下载时使用)|C|string| |shareShort|短链(分享下载时使用)|C|string| -|time|过期时间,大于10,小于43200(秒)|O|integer| +|time|过期时间,大于10,小于18000(秒)|O|integer| **响应状态**: @@ -893,7 +909,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 GET /disk-file/resource/download?fileId=&preview=false HTTP/1.1 Host: cloud.api.novelweb.cn -Cookie: bjg_sid=ab318bdb-4871-4fa8-a736-2e894ee3f507 +Authorization: ab318bdb-4871-4fa8-a736-2e894ee3f507 ``` ## 查询文件列表 @@ -987,7 +1003,84 @@ Cookie: bjg_sid=ab318bdb-4871-4fa8-a736-2e894ee3f507 GET /disk-file/search?page=1&pageSize=100&userFileParentId=0 HTTP/1.1 Host: cloud.api.novelweb.cn -Cookie: bjg_sid=ab318bdb-4871-4fa8-a736-2e894ee3f507 +Authorization: ab318bdb-4871-4fa8-a736-2e894ee3f507 +``` + +## 指定文件标识批量查找 + +**接口地址**:`/disk-file/query/file` + +**请求方式**:`POST` + +**请求数据类型**:`application/json` + +**响应数据类型**:`application/json;charset=UTF-8` + +**接口描述**: +根据文件标识信息批量查询文件信息,单次最大请求100条数据
+ +**请求参数**: + +| 参数名称 | 参数说明 | 约束 | 数据类型 | +| -------- | -------- | ----- | ------ | +|file|需要查询的文件标识列表|M|string| + +**响应参数**: + +| 参数名称 | 参数说明 | 类型 | 约束 | +| -------- | -------- | ----- |----- | +|code|状态码|string|M| +|data|对象|array|C| +| createTime|创建时间|string|M| +| fileFolder|是否为文件夹|boolean|M| +| forbidden|当前文件是否被禁止访问|boolean|M| +| ossFileEtag|资源的唯一标识|string|M| +| ossFileMimeType|文件的mime类型|string|M| +| ossFileSize|文件大小(字节)|integer|M| +| updateTime|更新时间|string|M| +| userDynamicDownloadUrl|文件的动态下载链接|string|C| +| userDynamicPreviewUrl|文件的动态预览链接|string|C| +| userFileId|文件标识|string|M| +| userFileName|文件名称|string|M| +| userFileParentId|父级标识(0为根目录)|string|M| +| userId|用户标识|integer|M| +|message|描述|string|M| + +**响应示例**: + +```json +{ + "code": "200", + "data": [{ + "createTime": "", + "fileFolder": true, + "forbidden": true, + "ossFileEtag": "", + "ossFileMimeType": "", + "ossFileSize": 0, + "updateTime": "", + "userDynamicDownloadUrl": "", + "userDynamicPreviewUrl": "", + "userFileId": "", + "userFileName": "", + "userFileParentId": "", + "userId": 0 + }], + "message": "请求成功" +} +``` + +**请求示例**: + +```http request +POST /disk-file/query/file +HTTP/1.1 +Host: cloud.api.novelweb.cn +Authorization: ab318bdb-4871-4fa8-a736-2e894ee3f507 + +{ + "file": ["617417f41a74e2521eac4e660e73zu"] +} ``` ## 批量复制文件 @@ -1111,7 +1204,7 @@ POST /disk-file/copy-batch-file HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "targetFileId": 0, @@ -1168,7 +1261,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 ```json { - "code": "", + "code": "200", "data": [ { "createTime": "", @@ -1186,7 +1279,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 "userId": 0 } ], - "message": "" + "message": "请求成功" } ``` @@ -1197,7 +1290,7 @@ POST /disk-file/move-batch-file HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "moveFileInfo": [ @@ -1258,7 +1351,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 ```json { - "code": "", + "code": "200", "data": { "available": true, "createTime": "", @@ -1278,7 +1371,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 "userRemainingTraffic": 0, "userUnlockTime": "" }, - "message": "" + "message": "请求成功" } ``` @@ -1289,7 +1382,7 @@ POST /disk-file/delete-batch-file HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 [1,2,3,4] ``` @@ -1308,7 +1401,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 **接口描述**:用于创建文件分享短链,通过短链可以访问被分享的文件
-最多只能同时分享50个文件、文件夹
+最多只能同时分享120个文件、文件夹
**请求参数**: @@ -1340,7 +1433,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 ```json { - "code": "", + "code": "200", "data": { "expiration": false, "includeFolder": false, @@ -1353,7 +1446,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 "shareShortUrl": "", "shareUserId": 0 }, - "message": "" + "message": "请求成功" } ``` @@ -1364,7 +1457,7 @@ POST /disk-share/create-share HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "encrypt": false, @@ -1418,7 +1511,7 @@ POST /disk-share/cancel-share HTTP/1.1 Host: cloud.api.novelweb.cn Content-Type: application/json -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 { "shareId": [1,2,3,4] @@ -1504,7 +1597,7 @@ Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 GET /disk-share/search?page=1&pageSize=10 HTTP/1.1 Host: cloud.api.novelweb.cn -Cookie: bjg_sid=2d814ef-6d81-4560-ad07-6701c12c73 +Authorization: 2d814ef-6d81-4560-ad07-6701c12c73 ``` ## 获取分享链接详情