mirror of
https://github.com/YMFE/yapi.git
synced 2025-02-17 13:49:43 +08:00
Merge branch feature-pr of https://github.com/YMFE/yapi into hotfix
This commit is contained in:
commit
568434f782
@ -297,6 +297,8 @@ class interfaceController extends baseController {
|
||||
this.projectModel.up(params.project_id, { up_time: new Date().getTime() }).then();
|
||||
});
|
||||
|
||||
await this.autoAddTag(params);
|
||||
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}
|
||||
|
||||
@ -387,6 +389,45 @@ class interfaceController extends baseController {
|
||||
// return ctx.body = yapi.commons.resReturn(null, 400, 'path第一位必需为 /, 只允许由 字母数字-/_:.! 组成');
|
||||
}
|
||||
|
||||
async autoAddTag(params) {
|
||||
//检查是否提交了目前不存在的tag
|
||||
let tags = params.tag;
|
||||
if (tags && Array.isArray(tags) && tags.length > 0) {
|
||||
let projectData = await this.projectModel.get(params.project_id);
|
||||
let tagsInProject = projectData.tag;
|
||||
let needUpdate = false;
|
||||
if (tagsInProject && Array.isArray(tagsInProject) && tagsInProject.length > 0) {
|
||||
tags.forEach(tag => {
|
||||
if (!_.find(tagsInProject, item => {
|
||||
return item.name === tag;
|
||||
})) {//tag不存在
|
||||
needUpdate = true;
|
||||
tagsInProject.push({
|
||||
name: tag,
|
||||
desc: tag
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
needUpdate = true
|
||||
tagsInProject = []
|
||||
tags.forEach(tag => {
|
||||
tagsInProject.push({
|
||||
name: tag,
|
||||
desc: tag
|
||||
});
|
||||
});
|
||||
}
|
||||
if (needUpdate) {//需要更新tag
|
||||
let data = {
|
||||
tag: tagsInProject,
|
||||
up_time: yapi.commons.time()
|
||||
};
|
||||
await this.projectModel.up(params.project_id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目分组
|
||||
* @interface /interface/get
|
||||
@ -781,6 +822,8 @@ class interfaceController extends baseController {
|
||||
}
|
||||
|
||||
yapi.emitHook('interface_update', id).then();
|
||||
await this.autoAddTag(params);
|
||||
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
return 1;
|
||||
}
|
||||
|
@ -26,6 +26,15 @@ function connect(callback) {
|
||||
options.pass = config.db.pass;
|
||||
}
|
||||
|
||||
if (config.db.reconnectTries) {
|
||||
options.reconnectTries = config.db.reconnectTries;
|
||||
}
|
||||
|
||||
if (config.db.reconnectInterval) {
|
||||
options.reconnectInterval = config.db.reconnectInterval;
|
||||
}
|
||||
|
||||
|
||||
options = Object.assign({}, options, config.db.options)
|
||||
|
||||
var connectString = '';
|
||||
|
1
static/prd/index@8202947f0c05ff5e96d8.css
Normal file
1
static/prd/index@8202947f0c05ff5e96d8.css
Normal file
File diff suppressed because one or more lines are too long
BIN
static/prd/index@8202947f0c05ff5e96d8.css.gz
Normal file
BIN
static/prd/index@8202947f0c05ff5e96d8.css.gz
Normal file
Binary file not shown.
1
static/prd/index@8202947f0c05ff5e96d8.js
Normal file
1
static/prd/index@8202947f0c05ff5e96d8.js
Normal file
File diff suppressed because one or more lines are too long
BIN
static/prd/index@8202947f0c05ff5e96d8.js.gz
Normal file
BIN
static/prd/index@8202947f0c05ff5e96d8.js.gz
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user