diff --git a/client/containers/Project/Setting/ProjectData/ProjectData.js b/client/containers/Project/Setting/ProjectData/ProjectData.js index c9d1a106..623067ca 100755 --- a/client/containers/Project/Setting/ProjectData/ProjectData.js +++ b/client/containers/Project/Setting/ProjectData/ProjectData.js @@ -122,10 +122,9 @@ class ProjectData extends Component { if (this.props.basePath) { data.path = data.path.indexOf(this.props.basePath) === 0 ? data.path.substr(this.props.basePath.length) : data.path; } - if (data.catname && cats[data.catname].id) { + if (data.catname && cats[data.catname] && typeof cats[data.catname] === 'object' && cats[data.catname].id) { data.catid = cats[data.catname].id; } - let result = await axios.post('/api/interface/add', data); count++; if (result.data.errcode) { diff --git a/exts/yapi-plugin-import-swagger/client.js b/exts/yapi-plugin-import-swagger/client.js index 44cffbae..20613120 100644 --- a/exts/yapi-plugin-import-swagger/client.js +++ b/exts/yapi-plugin-import-swagger/client.js @@ -51,7 +51,7 @@ function improtData(importDataModule){ let api = {}; //处理基本信息 api.method = data.method.toUpperCase(); - api.title = data.summary; + api.title = data.summary || data.path; api.desc = data.description; api.catname = data.tags && Array.isArray(data.tags)? data.tags[0] : null; api.path = handlePath(data.path); @@ -122,11 +122,16 @@ function improtData(importDataModule){ _.each(api, (res, code)=>{ if(code == 200){ if(res && typeof res === 'object'){ - res_body = handleSchema(res.schema); + if(res.schema){ + res_body = handleSchema(res.schema); + }else if(res.description){ + res_body = res.description; + } + }else if(typeof res === 'string'){ + res_body = res; }else{ res_body = ''; - } - + } } }) return res_body;