diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js index 23b62ae0..c1dfea9f 100644 --- a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js @@ -14,9 +14,9 @@ const TreeNode = Tree.TreeNode; @connect( - + state => { - + return { list: state.inter.list, inter: state.inter.curdata, @@ -174,12 +174,12 @@ class InterfaceMenu extends Component { title: '您确认删除此接口', content: '温馨提示:接口删除后,无法恢复', async onOk() { - + await that.props.deleteInterfaceData(id, that.props.projectId) await that.getList() ref.destroy() that.props.history.push('/project/' + that.props.match.params.id + '/interface/api') - + }, async onCancel() { ref.destroy() @@ -227,8 +227,8 @@ class InterfaceMenu extends Component { const matchParams = this.props.match.params; let menuList = this.state.list; const searchBox =
源码位置: - ./server/controllers/group.js:290 + ./server/controllers/group.js:303
@@ -971,7 +971,7 @@源码位置: - ./server/controllers/group.js:330 + ./server/controllers/group.js:343
@@ -3511,7 +3511,7 @@源码位置: - ./server/controllers/interface.js:168 + ./server/controllers/interface.js:181
@@ -3576,7 +3576,7 @@源码位置: - ./server/controllers/interface.js:193 + ./server/controllers/interface.js:206
@@ -3641,7 +3641,7 @@源码位置: - ./server/controllers/interface.js:255 + ./server/controllers/interface.js:268
@@ -3874,7 +3874,7 @@源码位置: - ./server/controllers/interface.js:427 + ./server/controllers/interface.js:440
@@ -3946,7 +3946,7 @@源码位置: - ./server/controllers/interface.js:615 + ./server/controllers/interface.js:628
diff --git a/static/doc/index-使用mock功能.html b/static/doc/index-使用mock功能.html index ba442ea5..67a097cf 100644 --- a/static/doc/index-使用mock功能.html +++ b/static/doc/index-使用mock功能.html @@ -144,14 +144,14 @@mockd地址: http://yapi.corp.qunar.com/mock/29/api/hackathon/login
注:项目id可以在项目设置里查看到
{
- "status|0-1": 0, //接口状态
+ "status|0-1": 0, //接口状态
"message": "请求完成", //消息提示
"data": {
"counts":"@integer", //统计数量
- "totalSubjectType|4-10": [
+ "totalSubjectType|4-10": [
{
- "subjectName|regexp": "大数据|机器学习|工具", //主题名
- "subjectType|+1": 1 //类型
+ "subjectName|regexp": "大数据|机器学习|工具", //主题名
+ "subjectType|+1": 1 //类型
}
],
"data":[
@@ -164,8 +164,8 @@
}
因为yapi基于json定义mock,无法使用mockjs原有的函数功能,正则表达式需要基于rule书写,示例如下:
{
- "name|regexp": "[a-z0-9_]+?",
- "type|regexp": "json|text|xml" //枚举数据类型可这样实现
+ "name|regexp": "[a-z0-9_]+?",
+ "type|regexp": "json|text|xml" //枚举数据类型可这样实现
}
在代码直接请求yapi提供的mock地址,以jQuery为例:
let prefix = 'http://yapi.local.qunar.com:3000/mock/2817'
@@ -196,9 +196,9 @@ $.post2. 数据占位符定义规范(Data Placeholder Definition,DPD)
数据模板定义规范(Data Template Definition,DTD) #
数据模板中的每个属性由 3 部分构成:属性名、生成规则、属性值:
-// 属性名 name (与生成规则之间用 "|" 隔开)
-// 生成规则 rule(生成规则有7种详见下面的生成规则)
-// 属性值 value(可以含有 "@占位符" 同时也指定了最终值的初始值和类型)
+// 属性名 name (与生成规则之间用 "|" 隔开)
+// 生成规则 rule(生成规则有7种详见下面的生成规则)
+// 属性值 value(可以含有 "@占位符" 同时也指定了最终值的初始值和类型)
'name|rule': value
diff --git a/static/doc/source/app.js b/static/doc/source/app.js
index 2a53b85a..24b1b76c 100644
--- a/static/doc/source/app.js
+++ b/static/doc/source/app.js
@@ -8,7 +8,6 @@ $(document).ready(function() {
var $versionSelector = $('.version-selector');
var $versionMask = $('.m-version-mask');
var isPanelHide = true;
- var winWidth = $(window).width();
var h2 = $('.content-right').find('h2');
var h3 = $('.content-right').find('h3');
var a = $('.content-left').find('a');
diff --git a/static/doc/static/server/controllers/group.js.html b/static/doc/static/server/controllers/group.js.html
index afde93c7..792a32e1 100644
--- a/static/doc/static/server/controllers/group.js.html
+++ b/static/doc/static/server/controllers/group.js.html
@@ -309,7 +309,20 @@ class groupController extends baseController {
try {
var groupInst = yapi.getInst(groupModel);
let result = await groupInst.list();
- ctx.body = yapi.commons.resReturn(result);
+ let newResult = [];
+ if(result && result.length > 0){
+ for(let i=0; i< result.length; i++){
+ result[i] = result[i].toObject();
+ result[i].role = await this.checkAuth(result[i]._id, 'group', 'edit');
+ if(result[i].role){
+ newResult.unshift(result[i]);
+ }else{
+ newResult.push(result[i]);
+ }
+ }
+ }
+
+ ctx.body = yapi.commons.resReturn(newResult);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}
diff --git a/static/doc/static/server/controllers/interface.js.html b/static/doc/static/server/controllers/interface.js.html
index b6e75131..ab322515 100644
--- a/static/doc/static/server/controllers/interface.js.html
+++ b/static/doc/static/server/controllers/interface.js.html
@@ -103,9 +103,22 @@ class interfaceController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '接口请求路径不能为空');
}
- if (!yapi.commons.verifyPath(params.path)) {
+ let http_path = url.parse(params.path, true);
+ params.path = http_path.pathname;
+
+ if (!yapi.commons.verifyPath(http_path.pathname)) {
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
}
+
+ if(!params.req_query){
+ params.req_query = [];
+ Object.keys(http_path.query).forEach((item)=>{
+ params.req_query.push({
+ name: item
+ })
+ })
+ }
+
let checkRepeat = await this.Model.checkRepeat(params.project_id, params.path, params.method);