Merge branch 'dev-1.2.0'

This commit is contained in:
suxiaoxin 2017-10-30 17:15:31 +08:00
commit eb2e4c32e9
2 changed files with 10 additions and 6 deletions

View File

@ -122,10 +122,9 @@ class ProjectData extends Component {
if (this.props.basePath) { if (this.props.basePath) {
data.path = data.path.indexOf(this.props.basePath) === 0 ? data.path.substr(this.props.basePath.length) : data.path; 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; data.catid = cats[data.catname].id;
} }
let result = await axios.post('/api/interface/add', data); let result = await axios.post('/api/interface/add', data);
count++; count++;
if (result.data.errcode) { if (result.data.errcode) {

View File

@ -51,7 +51,7 @@ function improtData(importDataModule){
let api = {}; let api = {};
//处理基本信息 //处理基本信息
api.method = data.method.toUpperCase(); api.method = data.method.toUpperCase();
api.title = data.summary; api.title = data.summary || data.path;
api.desc = data.description; api.desc = data.description;
api.catname = data.tags && Array.isArray(data.tags)? data.tags[0] : null; api.catname = data.tags && Array.isArray(data.tags)? data.tags[0] : null;
api.path = handlePath(data.path); api.path = handlePath(data.path);
@ -122,11 +122,16 @@ function improtData(importDataModule){
_.each(api, (res, code)=>{ _.each(api, (res, code)=>{
if(code == 200){ if(code == 200){
if(res && typeof res === 'object'){ 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{ }else{
res_body = ''; res_body = '';
} }
} }
}) })
return res_body; return res_body;