fix: up interface params.path, method repeat bug

This commit is contained in:
suxiaoxin 2017-08-29 11:46:10 +08:00
parent d3d93e9dbc
commit d998549d91
2 changed files with 2 additions and 4 deletions

View File

@ -251,7 +251,6 @@ class interfaceController extends baseController {
async up(ctx) {
let params = ctx.request.body;
params = yapi.commons.handleParams(params, {
title: 'string',
path: 'string',
@ -279,7 +278,7 @@ class interfaceController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
}
if (params.path && params.path !== interfaceData.path && params.method !== interfaceData.method) {
if (params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method) ) {
let checkRepeat = await this.Model.checkRepeat(interfaceData.project_id, params.path, params.method);
if (checkRepeat > 0) {
return ctx.body = yapi.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']');

View File

@ -555,7 +555,6 @@ var interfaceController = function (_baseController) {
case 0:
params = ctx.request.body;
params = _yapi2.default.commons.handleParams(params, {
title: 'string',
path: 'string',
@ -604,7 +603,7 @@ var interfaceController = function (_baseController) {
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
case 17:
if (!(params.path && params.path !== interfaceData.path && params.method !== interfaceData.method)) {
if (!(params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method))) {
_context6.next = 23;
break;
}