mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
Merge branch 'dev-1.2.0'
This commit is contained in:
commit
eb2e4c32e9
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user