Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
wenbo.dong 2017-08-21 18:11:12 +08:00
commit 93083258ee
5 changed files with 30 additions and 24 deletions

View File

@ -4,14 +4,8 @@
<p style='text-indent:2em;line-height:1.8em'>YApi是<strong>高效</strong><strong>易用</strong><strong>功能强大</strong>、的api管理平台旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护、监控和保护任意规模的 APIyapi还为用户提供了优秀的交互体验开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理。</p>
## 二、特性
* 完善的项目接口管理功能
* 易用的MockServer
* 类gitlab的用户管理和权限管理功能
* 强大的接口集功能
## 二、功能
* REST API
* MockServer
* 扁平化的项目管理
* 用户管理集成了qsso登录

View File

@ -94,7 +94,7 @@ class interfaceColController extends baseController{
try {
let id = ctx.query.col_id;
let inst = yapi.getInst(interfaceCaseModel);
let result = await inst.list(id);
let result = await inst.list(id, 'all');
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);

View File

@ -11,12 +11,12 @@ class interfaceCase extends baseModel {
casename: { type: String, required: true },
uid: { type: Number, required: true },
col_id: { type: Number, required: true },
index: {type: Number, default:0},
index: { type: Number, default: 0 },
project_id: { type: Number, required: true },
add_time: Number,
up_time: Number,
env: { type: String },
domain: {type: String },
domain: { type: String },
path: { type: String },
method: { type: String },
req_params: [{
@ -51,7 +51,13 @@ class interfaceCase extends baseModel {
}).exec();
}
list(col_id) {
list(col_id, select) {
select = select || 'casename uid col_id _id index'
if (select === 'all') {
return this.model.find({
col_id: col_id
}).exec();
}
return this.model.find({
col_id: col_id
}).select("casename uid col_id _id index").exec();
@ -63,13 +69,13 @@ class interfaceCase extends baseModel {
});
}
delByProjectId(id){
delByProjectId(id) {
return this.model.deleteMany({
project_id: id
})
}
delByCol(id){
delByCol(id) {
return this.model.deleteMany({
col_id: id
})
@ -83,12 +89,12 @@ class interfaceCase extends baseModel {
);
}
upCaseIndex(id, index){
upCaseIndex(id, index) {
return this.model.update({
_id: id
},{
index: index
})
}, {
index: index
})
}
}

View File

@ -243,7 +243,7 @@ var interfaceColController = function (_baseController) {
id = ctx.query.col_id;
inst = _yapi2.default.getInst(_interfaceCase2.default);
_context3.next = 5;
return inst.list(id);
return inst.list(id, 'all');
case 5:
result = _context3.sent;

View File

@ -93,7 +93,13 @@ var interfaceCase = function (_baseModel) {
}
}, {
key: 'list',
value: function list(col_id) {
value: function list(col_id, select) {
select = select || 'casename uid col_id _id index';
if (select === 'all') {
return this.model.find({
col_id: col_id
}).exec();
}
return this.model.find({
col_id: col_id
}).select("casename uid col_id _id index").exec();