mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
feat: modify db config_dev
This commit is contained in:
parent
c3c232694f
commit
de689bc921
@ -26,7 +26,7 @@ class LeftMenu extends Component {
|
|||||||
title: '个人资料',
|
title: '个人资料',
|
||||||
path: '/user/profile'
|
path: '/user/profile'
|
||||||
}, {
|
}, {
|
||||||
title: '用户管理11',
|
title: '用户管理',
|
||||||
path: '/user/list'
|
path: '/user/list'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
"servername": "10.86.40.194",
|
"servername": "10.86.40.194",
|
||||||
"DATABASE": "yapi",
|
"DATABASE": "yapi",
|
||||||
"port": 27017,
|
"port": 27017,
|
||||||
"user": "admin",
|
"user": "yapi",
|
||||||
"pass": "qunar.com"
|
"pass": "yapi"
|
||||||
},
|
},
|
||||||
"mail": {
|
"mail": {
|
||||||
"host": "smtp.163.com",
|
"host": "smtp.163.com",
|
||||||
|
@ -18,24 +18,23 @@ module.exports = async (ctx, next) => {
|
|||||||
return ctx.body = yapi.commons.resReturn(null, 403, e.message);
|
return ctx.body = yapi.commons.resReturn(null, 403, e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
let matchProject = [];
|
let matchProject = false, maxBasepath = 0;
|
||||||
for(let i=0, l = projects.length; i< l; i++){
|
for(let i=0, l = projects.length; i< l; i++){
|
||||||
let project = projects[i];
|
let project = projects[i];
|
||||||
if(ctx.path && ctx.path.indexOf(project.basepath) === 0 && project.basepath[project.basepath.length -1] === '/'){
|
if(ctx.path && ctx.path.indexOf(project.basepath) === 0 && project.basepath[project.basepath.length -1] === '/'){
|
||||||
matchProject.push(project);
|
matchProject.push(project);
|
||||||
|
if(project.basepath.length > maxBasepath){
|
||||||
|
maxBasepath = project.basepath.length;
|
||||||
|
matchProject = project;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(matchProject === false){
|
||||||
if(matchProject.length === 0){
|
|
||||||
return ctx.body = yapi.commons.resReturn(null, 400, '不存在的domain');
|
return ctx.body = yapi.commons.resReturn(null, 400, '不存在的domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(matchProject.length > 1){
|
let project = matchProject, interfaceData;
|
||||||
return ctx.body = yapi.commons.resReturn(null, 401, '存在多个project,请检查数据库');
|
|
||||||
}
|
|
||||||
|
|
||||||
let project = matchProject[0], interfaceData;
|
|
||||||
let interfaceInst = yapi.getInst(interfaceModel);
|
let interfaceInst = yapi.getInst(interfaceModel);
|
||||||
try{
|
try{
|
||||||
interfaceData = await interfaceInst.getByPath(project._id, ctx.path.substr(project.basepath.length));
|
interfaceData = await interfaceInst.getByPath(project._id, ctx.path.substr(project.basepath.length));
|
||||||
|
Loading…
Reference in New Issue
Block a user