mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: interfaceCol 数据不同步问题
This commit is contained in:
parent
6633b47800
commit
bd10b24586
@ -116,6 +116,11 @@ class interfaceColController extends baseController{
|
||||
|
||||
result[index] = result[index].toObject();
|
||||
let interfaceData = await this.interfaceModel.getBaseinfo(result[index].interface_id);
|
||||
if(!interfaceData){
|
||||
await this.caseModel.del(result[index]._id);
|
||||
result[index] = undefined;
|
||||
continue;
|
||||
}
|
||||
let projectData = await this.projectModel.getBaseInfo(interfaceData.project_id);
|
||||
result[index].path = projectData.basepath + interfaceData.path;
|
||||
result[index].method = interfaceData.method;
|
||||
@ -295,8 +300,11 @@ class interfaceColController extends baseController{
|
||||
}
|
||||
result = result.toObject();
|
||||
let data = await this.interfaceModel.get(result.interface_id);
|
||||
if(!data){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '找不到对应的接口,请联系管理员')
|
||||
}
|
||||
data = data.toObject();
|
||||
let projectData = await this.projectModel.getBaseInfo(data.project_id);
|
||||
let projectData = await this.projectModel.getBaseInfo(data.project_id);
|
||||
result.path = projectData.basepath + data.path;
|
||||
result.method = data.method;
|
||||
result.req_body_type = data.req_body_type;
|
||||
|
@ -76,6 +76,7 @@ class interfaceCase extends baseModel {
|
||||
}
|
||||
|
||||
delByInterfaceId(id){
|
||||
console.log("delCase", id);
|
||||
return this.model.deleteMany({
|
||||
interface_id: id
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user