mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
fix: 修改bug
This commit is contained in:
parent
d80b631a65
commit
32caa34f09
@ -1,3 +1,12 @@
|
||||
### v1.3.17
|
||||
|
||||
#### Bug Fixed
|
||||
* 修复服务器端测试,邮件通知开启token undefined bug
|
||||
* 将状态由未完成修改成已完成之后,原来的json格式的数据会变成json-schema
|
||||
* 有分类为空时导出json后再导入报错
|
||||
* 只修改参数 必需/非必需, 文本/文件 时, 查看改动详情, 提示没有改动
|
||||
|
||||
|
||||
### v1.3.16
|
||||
|
||||
* 支持自定义域名邮箱登录
|
||||
|
41
a.markdown
41
a.markdown
@ -1,5 +1,5 @@
|
||||
|
||||
<h1 class="curproject-name"> test_22(copy_copy) </h1>
|
||||
<h1 class="curproject-name"> 导入导出测试 </h1>
|
||||
|
||||
|
||||
|
||||
@ -7,43 +7,20 @@
|
||||
[TOC]
|
||||
|
||||
|
||||
## cluster%0A%3Ca%20id%3Dcluster%3E%20%3C/a%3E
|
||||
# www
|
||||
[TOC]
|
||||
|
||||
|
||||
## test%0A%3Ca%20id%3Dtest%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /cluster
|
||||
**Path:** /api/col/list
|
||||
|
||||
**Method:** POST
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
**Headers**
|
||||
|
||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| X-Auth-User | | 是 | | |
|
||||
| X-Auth-Project | | 是 | | |
|
||||
| X-Auth-token | | 是 | | |
|
||||
| Content-Type | multipart/form-data | 是 | | |
|
||||
**Query**
|
||||
|
||||
| 参数名称 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ |
|
||||
| qw | 是 | | |
|
||||
**Body**
|
||||
|
||||
| 参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| 1 | text | 是 | | |
|
||||
| 2 | file | 是 | | |
|
||||
|
||||
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{"type":"object","title":"empty object","properties":{"id":{"type":"object","properties":{"field_1":{"type":"object","properties":{"field_2":{"type":"object","properties":{"field_3":{"type":"object","properties":{"field_4":{"type":"object","properties":{"field_5":{"type":"object","properties":{"field_6":{"type":"object","properties":{"field_7额 u 俄 u 俄 u 茹茹茹茹茹茹茹rrururuueueue ":{"type":"string"}},"required":[]}}}}}}}}}}}}},"msg":{"type":"string"}},"required":[]}
|
||||
```
|
@ -227,8 +227,8 @@ class TimeTree extends Component {
|
||||
if (this.state.loading) {
|
||||
pending = <Spin />
|
||||
}
|
||||
|
||||
let diffView = showDiffMsg(jsondiffpatch, formattersHtml, curDiffData);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
|
@ -41,15 +41,16 @@ module.exports = function (jsondiffpatch, formattersHtml, curDiffData) {
|
||||
}
|
||||
|
||||
const handleParams = (item) => {
|
||||
item._id = undefined;
|
||||
let newItem = Object.assign({}, item);
|
||||
newItem._id = undefined;
|
||||
|
||||
Object.keys(item).forEach(key => {
|
||||
Object.keys(newItem).forEach(key => {
|
||||
switch (key) {
|
||||
case 'required': item[key] = valueMaps[item[key]]; break;
|
||||
case 'type': item[key] = valueMaps[item[key]]; break;
|
||||
case 'required': newItem[key] = valueMaps[newItem[key]]; break;
|
||||
case 'type': newItem[key] = valueMaps[newItem[key]]; break;
|
||||
}
|
||||
})
|
||||
return item;
|
||||
return newItem;
|
||||
}
|
||||
|
||||
const diffArray = (arr1, arr2) => {
|
||||
|
@ -170,6 +170,18 @@ context.promise = new Promise(function(resolve){
|
||||
|
||||
})
|
||||
```
|
||||
promise 还可以来设置接口延迟
|
||||
|
||||
```javascript
|
||||
context.promise = new Promise(function(resolve){
|
||||
setTimeout(function(){
|
||||
console.log('delay 1000ms')
|
||||
resolve('ok')
|
||||
}, 1000)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
|
||||
使用方法就是在 `context` 里面添加 `promise` 参数,并且返回一个 Promise,不熟悉 Promise 的童鞋可以查下相关用法,ajax 请求可以使用 `context.utils.axios` 库。
|
||||
|
||||
|
@ -28,16 +28,15 @@ class exportController extends baseController {
|
||||
list = list.sort((a, b) => {
|
||||
return a.index - b.index;
|
||||
});
|
||||
if (list.length > 0) {
|
||||
item.list = list;
|
||||
newResult[i] = item;
|
||||
}
|
||||
item.list = list;
|
||||
newResult[i] = item;
|
||||
}
|
||||
|
||||
return newResult;
|
||||
}
|
||||
|
||||
handleExistId(data) {
|
||||
|
||||
function delArrId(arr, fn) {
|
||||
if (!Array.isArray(arr)) return;
|
||||
arr.forEach(item => {
|
||||
@ -88,6 +87,7 @@ class exportController extends baseController {
|
||||
return (ctx.body = tp);
|
||||
}
|
||||
case 'json': {
|
||||
|
||||
let data = this.handleExistId(list);
|
||||
tp = JSON.stringify(data, null, 2);
|
||||
ctx.set('Content-Disposition', `attachment; filename=api.json`);
|
||||
|
@ -493,8 +493,8 @@ class interfaceController extends baseController {
|
||||
let id = params.id;
|
||||
params.message = params.message || '';
|
||||
params.message = params.message.replace(/\n/g, "<br>")
|
||||
params.res_body_is_json_schema = _.isUndefined (params.res_body_is_json_schema) ? true : params.res_body_is_json_schema;
|
||||
params.req_body_is_json_schema = _.isUndefined(params.req_body_is_json_schema) ? true : params.req_body_is_json_schema;
|
||||
// params.res_body_is_json_schema = _.isUndefined (params.res_body_is_json_schema) ? true : params.res_body_is_json_schema;
|
||||
// params.req_body_is_json_schema = _.isUndefined(params.req_body_is_json_schema) ? true : params.req_body_is_json_schema;
|
||||
|
||||
let interfaceData = await this.Model.get(id);
|
||||
if (!interfaceData) {
|
||||
@ -550,6 +550,7 @@ class interfaceController extends baseController {
|
||||
let result = await this.Model.up(id, data);
|
||||
let username = this.getUsername();
|
||||
let CurrentInterfaceData = await this.Model.get(id);
|
||||
console.log('interface', interfaceData);
|
||||
let logData = {
|
||||
interface_id: id,
|
||||
cat_id: data.catid,
|
||||
@ -557,6 +558,7 @@ class interfaceController extends baseController {
|
||||
old: interfaceData.toObject()
|
||||
}
|
||||
|
||||
|
||||
this.catModel.get(interfaceData.catid).then((cate) => {
|
||||
yapi.commons.saveLog({
|
||||
content: `<a href="/user/profile/${this.getUid()}">${username}</a>
|
||||
@ -573,7 +575,16 @@ class interfaceController extends baseController {
|
||||
this.projectModel.up(interfaceData.project_id, { up_time: new Date().getTime() }).then();
|
||||
|
||||
if (params.switch_notice === true) {
|
||||
// console.log('logData', logData);
|
||||
// let logDiffData = {
|
||||
// interface_id: id,
|
||||
// cat_id: data.catid,
|
||||
// current: CurrentInterfaceData.toObject(),
|
||||
// old: interfaceData.toObject()
|
||||
// }
|
||||
|
||||
let diffView = showDiffMsg(jsondiffpatch, formattersHtml, logData);
|
||||
|
||||
|
||||
let annotatedCss = fs.readFileSync(path.resolve(yapi.WEBROOT, 'node_modules/jsondiffpatch/public/formatters-styles/annotated.css'), 'utf8');
|
||||
let htmlCss = fs.readFileSync(path.resolve(yapi.WEBROOT, 'node_modules/jsondiffpatch/public/formatters-styles/html.css'), 'utf8');
|
||||
|
@ -381,6 +381,7 @@ exports.saveLog = logData => {
|
||||
typeid: logData.typeid,
|
||||
data: logData.data
|
||||
};
|
||||
|
||||
logInst.save(data).then();
|
||||
} catch (e) {
|
||||
yapi.commons.log(e, 'error'); // eslint-disable-line
|
||||
|
Loading…
Reference in New Issue
Block a user