From 13265d22abf50f919936fa88127fd03ae4bd5e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=B8=8C=E9=87=8C?= Date: Mon, 28 Aug 2017 20:29:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9basepath=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BB=A5=E5=8F=8Ainterface=E7=BC=96=E8=BE=91bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/Project/Interface/Interface.js | 11 ++++++-- .../Project/Interface/InterfaceList/Edit.js | 2 +- .../InterfaceList/InterfaceEditForm.js | 4 +-- .../Setting/ProjectMessage/ProjectMessage.js | 2 -- server_dist/app.js | 2 +- server_dist/controllers/base.js | 10 +++---- server_dist/controllers/follow.js | 6 ++-- server_dist/controllers/group.js | 22 +++++++-------- server_dist/controllers/interface.js | 22 +++++++-------- server_dist/controllers/interfaceCol.js | 20 ++++++------- server_dist/controllers/log.js | 2 +- server_dist/controllers/user.js | 28 +++++++++---------- server_dist/middleware/mockServer.js | 2 +- server_dist/router.js | 2 +- server_dist/websocket.js | 2 +- 15 files changed, 70 insertions(+), 67 deletions(-) diff --git a/client/containers/Project/Interface/Interface.js b/client/containers/Project/Interface/Interface.js index 3d763a9a..e7c53123 100644 --- a/client/containers/Project/Interface/Interface.js +++ b/client/containers/Project/Interface/Interface.js @@ -13,7 +13,7 @@ import InterfaceContent from './InterfaceList/InterfaceContent.js' import InterfaceColMenu from './InterfaceCol/InterfaceColMenu.js' import InterfaceColContent from './InterfaceCol/InterfaceColContent.js' import InterfaceCaseContent from './InterfaceCol/InterfaceCaseContent.js' - +import { getProject } from '../../../reducer/modules/project'; const contentRouter = { path: '/project/:id/interface/:action/:actionId', exact: true @@ -46,6 +46,8 @@ InterfaceRoute.propTypes = { return { isShowCol: state.interfaceCol.isShowCol } + },{ + getProject } ) class Interface extends Component { @@ -53,7 +55,8 @@ class Interface extends Component { match: PropTypes.object, history: PropTypes.object, location: PropTypes.object, - isShowCol: PropTypes.bool + isShowCol: PropTypes.bool, + getProject: PropTypes.func } constructor(props) { @@ -70,7 +73,9 @@ class Interface extends Component { } this.props.history.push('/project/' + params.id + '/interface/' + action) } - + componentWillMount(){ + this.props.getProject(this.props.match.params.id) + } render() { const { action } = this.props.match.params; const activeKey = action === 'api' ? 'api' : 'colOrCase'; diff --git a/client/containers/Project/Interface/InterfaceList/Edit.js b/client/containers/Project/Interface/InterfaceList/Edit.js index 64d76ce3..5c09ca5a 100644 --- a/client/containers/Project/Interface/InterfaceList/Edit.js +++ b/client/containers/Project/Interface/InterfaceList/Edit.js @@ -46,7 +46,7 @@ class InterfaceEdit extends Component { message.success('保存成功'); this.props.switchToView() } else { - message.success(result.data.errmsg) + message.error(result.data.errmsg) } } diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js b/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js index 37f2d83c..4a6bf061 100644 --- a/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js @@ -88,7 +88,7 @@ class InterfaceEditForm extends Component { if (!err) { if (values.res_body_type === 'json') values.res_body = this.state.res_body; values.req_params = this.state.req_params; - values.req_body_other = this.state.req_body_other; + // values.req_body_other = this.state.req_body_other; values.method = this.state.method; let isfile = false, isHavaContentType = false; if (values.req_body_type === 'form') { @@ -359,7 +359,7 @@ class InterfaceEditForm extends Component { {getFieldDecorator('title', { initialValue: this.state.title, rules: [{ - required: true, message: '清输入接口名称!' + required: true, message: '请输入接口名称!' }] })( diff --git a/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js b/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js index 9b798cbc..7c0b7ffe 100644 --- a/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js +++ b/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js @@ -235,8 +235,6 @@ class ProjectMessage extends Component { callback('请输入环境域名'); } else if (!/\S/.test(value)) { callback('请输入环境域名'); - } else if (/prd/.test(value)) { - callback('环境域名不能是"prd"'); } else { return callback(); } diff --git a/server_dist/app.js b/server_dist/app.js index 233694de..43dd2816 100644 --- a/server_dist/app.js +++ b/server_dist/app.js @@ -72,7 +72,7 @@ app.use(compress({ })); app.use(function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx, next) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) { return _regenerator2.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { diff --git a/server_dist/controllers/base.js b/server_dist/controllers/base.js index 6db7043c..37b0c525 100644 --- a/server_dist/controllers/base.js +++ b/server_dist/controllers/base.js @@ -59,7 +59,7 @@ var baseController = function () { (0, _createClass3.default)(baseController, [{ key: 'init', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var ignoreRouter; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -103,7 +103,7 @@ var baseController = function () { }, { key: 'checkLogin', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { var token, uid, userInst, result, decoded; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -170,7 +170,7 @@ var baseController = function () { }, { key: 'getLoginStatus', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) { var result; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -222,7 +222,7 @@ var baseController = function () { }, { key: 'getProjectRole', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(id, type) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(id, type) { var _this = this; var result, interfaceInst, interfaceData, projectInst, projectData, memberData, groupInst, groupData, groupMemberData; @@ -379,7 +379,7 @@ var baseController = function () { }, { key: 'checkAuth', value: function () { - var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(id, type, action) { + var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(id, type, action) { var role; return _regenerator2.default.wrap(function _callee5$(_context5) { while (1) { diff --git a/server_dist/controllers/follow.js b/server_dist/controllers/follow.js index b013f0dd..761a1995 100644 --- a/server_dist/controllers/follow.js +++ b/server_dist/controllers/follow.js @@ -74,7 +74,7 @@ var followController = function (_baseController) { (0, _createClass3.default)(followController, [{ key: 'list', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var uid, page, limit, result; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -139,7 +139,7 @@ var followController = function (_baseController) { }, { key: 'del', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { var params, uid, checkRepeat, result; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -217,7 +217,7 @@ var followController = function (_baseController) { }, { key: 'add', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) { var params, uid, checkRepeat, project, data, result; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { diff --git a/server_dist/controllers/group.js b/server_dist/controllers/group.js index ef922bdf..dd9591d8 100644 --- a/server_dist/controllers/group.js +++ b/server_dist/controllers/group.js @@ -88,7 +88,7 @@ var groupController = function (_baseController) { (0, _createClass3.default)(groupController, [{ key: 'get', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var params, groupInst, result; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -160,7 +160,7 @@ var groupController = function (_baseController) { }, { key: 'add', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { var params, groupUserdata, groupInst, checkRepeat, data, result; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -272,7 +272,7 @@ var groupController = function (_baseController) { }, { key: 'getUserdata', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(uid, role) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(uid, role) { var userInst, userData; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -333,7 +333,7 @@ var groupController = function (_baseController) { }, { key: 'addMember', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) { var params, groupInst, check, groupUserdata, result; return _regenerator2.default.wrap(function _callee4$(_context4) { while (1) { @@ -446,7 +446,7 @@ var groupController = function (_baseController) { }, { key: 'changeMemberRole', value: function () { - var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) { + var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) { var params, groupInst, check, result; return _regenerator2.default.wrap(function _callee5$(_context5) { while (1) { @@ -547,7 +547,7 @@ var groupController = function (_baseController) { }, { key: 'getMemberList', value: function () { - var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) { + var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) { var params, groupInst, group; return _regenerator2.default.wrap(function _callee6$(_context6) { while (1) { @@ -611,7 +611,7 @@ var groupController = function (_baseController) { }, { key: 'delMember', value: function () { - var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) { + var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) { var params, groupInst, check, result; return _regenerator2.default.wrap(function _callee7$(_context7) { while (1) { @@ -709,7 +709,7 @@ var groupController = function (_baseController) { }, { key: 'list', value: function () { - var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) { + var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) { var groupInst, result; return _regenerator2.default.wrap(function _callee8$(_context8) { while (1) { @@ -762,7 +762,7 @@ var groupController = function (_baseController) { }, { key: 'del', value: function () { - var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) { + var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) { var _this2 = this; var groupInst, projectInst, interfaceInst, interfaceColInst, interfaceCaseInst, id, projectList, result; @@ -801,7 +801,7 @@ var groupController = function (_baseController) { projectList = _context10.sent; projectList.forEach(function () { - var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(p) { + var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(p) { return _regenerator2.default.wrap(function _callee9$(_context9) { while (1) { switch (_context9.prev = _context9.next) { @@ -880,7 +880,7 @@ var groupController = function (_baseController) { }, { key: 'up', value: function () { - var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) { + var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) { var groupInst, id, data, result; return _regenerator2.default.wrap(function _callee11$(_context11) { while (1) { diff --git a/server_dist/controllers/interface.js b/server_dist/controllers/interface.js index ed9dded3..98c024f3 100644 --- a/server_dist/controllers/interface.js +++ b/server_dist/controllers/interface.js @@ -105,7 +105,7 @@ var interfaceController = function (_baseController) { (0, _createClass3.default)(interfaceController, [{ key: 'add', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var _this2 = this; var params, auth, checkRepeat, data, result; @@ -273,7 +273,7 @@ var interfaceController = function (_baseController) { }, { key: 'get', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { var params, result; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -335,7 +335,7 @@ var interfaceController = function (_baseController) { }, { key: 'list', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) { var project_id, result; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -385,7 +385,7 @@ var interfaceController = function (_baseController) { }, { key: 'listByCat', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) { var catid, result; return _regenerator2.default.wrap(function _callee4$(_context4) { while (1) { @@ -435,7 +435,7 @@ var interfaceController = function (_baseController) { }, { key: 'listByMenu', value: function () { - var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) { + var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) { var project_id, result, newResult, i, item, list, j; return _regenerator2.default.wrap(function _callee5$(_context5) { while (1) { @@ -540,7 +540,7 @@ var interfaceController = function (_baseController) { }, { key: 'up', value: function () { - var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) { + var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) { var _this3 = this; var params, id, interfaceData, auth, checkRepeat, data, result, username, cateid; @@ -747,7 +747,7 @@ var interfaceController = function (_baseController) { }, { key: 'del', value: function () { - var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) { + var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) { var _this4 = this; var id, data, auth, inter, result, username; @@ -840,7 +840,7 @@ var interfaceController = function (_baseController) { }, { key: 'solveConflict', value: function () { - var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) { + var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) { var _this5 = this; var id, result, userInst, userinfo, data; @@ -923,7 +923,7 @@ var interfaceController = function (_baseController) { }, { key: 'addCat', value: function () { - var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) { + var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) { var params, auth, result, username; return _regenerator2.default.wrap(function _callee9$(_context9) { while (1) { @@ -1018,7 +1018,7 @@ var interfaceController = function (_baseController) { }, { key: 'upCat', value: function () { - var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) { + var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) { var params, result, username, cate, auth; return _regenerator2.default.wrap(function _callee10$(_context10) { while (1) { @@ -1090,7 +1090,7 @@ var interfaceController = function (_baseController) { }, { key: 'delCat', value: function () { - var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) { + var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) { var id, catData, auth, username, result, r; return _regenerator2.default.wrap(function _callee11$(_context11) { while (1) { diff --git a/server_dist/controllers/interfaceCol.js b/server_dist/controllers/interfaceCol.js index cc4dcfb9..ae68ccb1 100644 --- a/server_dist/controllers/interfaceCol.js +++ b/server_dist/controllers/interfaceCol.js @@ -74,7 +74,7 @@ var interfaceColController = function (_baseController) { (0, _createClass3.default)(interfaceColController, [{ key: 'list', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var id, result, i; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -149,7 +149,7 @@ var interfaceColController = function (_baseController) { }, { key: 'addCol', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { var params, auth, result, username; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -255,7 +255,7 @@ var interfaceColController = function (_baseController) { }, { key: 'getCaseList', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) { var id, inst, result; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -319,7 +319,7 @@ var interfaceColController = function (_baseController) { }, { key: 'addCase', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) { var _this2 = this; var params, auth, result, username; @@ -448,7 +448,7 @@ var interfaceColController = function (_baseController) { }, { key: 'upCase', value: function () { - var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) { + var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) { var _this3 = this; var params, caseData, auth, result, username; @@ -561,7 +561,7 @@ var interfaceColController = function (_baseController) { }, { key: 'getCase', value: function () { - var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) { + var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) { var id, result; return _regenerator2.default.wrap(function _callee6$(_context6) { while (1) { @@ -615,7 +615,7 @@ var interfaceColController = function (_baseController) { }, { key: 'upCol', value: function () { - var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) { + var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) { var params, id, colData, auth, result, username; return _regenerator2.default.wrap(function _callee7$(_context7) { while (1) { @@ -700,7 +700,7 @@ var interfaceColController = function (_baseController) { }, { key: 'upCaseIndex', value: function () { - var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) { + var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) { var _this4 = this; var params; @@ -769,7 +769,7 @@ var interfaceColController = function (_baseController) { }, { key: 'delCol', value: function () { - var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) { + var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) { var id, colData, auth, result, username; return _regenerator2.default.wrap(function _callee9$(_context9) { while (1) { @@ -855,7 +855,7 @@ var interfaceColController = function (_baseController) { }, { key: 'delCase', value: function () { - var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) { + var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) { var _this5 = this; var caseid, caseData, auth, result, username; diff --git a/server_dist/controllers/log.js b/server_dist/controllers/log.js index 2ab32e45..bfb878e7 100644 --- a/server_dist/controllers/log.js +++ b/server_dist/controllers/log.js @@ -75,7 +75,7 @@ var logController = function (_baseController) { (0, _createClass3.default)(logController, [{ key: 'list', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var typeid, page, limit, type, result, count; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { diff --git a/server_dist/controllers/user.js b/server_dist/controllers/user.js index 21e7bff8..c32468f8 100644 --- a/server_dist/controllers/user.js +++ b/server_dist/controllers/user.js @@ -99,7 +99,7 @@ var userController = function (_baseController) { (0, _createClass3.default)(userController, [{ key: 'login', value: function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var userInst, email, password, result; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -190,7 +190,7 @@ var userController = function (_baseController) { }, { key: 'logout', value: function () { - var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) { + var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) { return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { @@ -248,7 +248,7 @@ var userController = function (_baseController) { }, { key: 'loginByToken', value: function () { - var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) { + var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) { var config, token, ret, login; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -300,7 +300,7 @@ var userController = function (_baseController) { }, { key: 'handleThirdLogin', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(email, username) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(email, username) { var user, data, passsalt, userInst; return _regenerator2.default.wrap(function _callee4$(_context4) { while (1) { @@ -384,7 +384,7 @@ var userController = function (_baseController) { }, { key: 'changePassword', value: function () { - var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) { + var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) { var params, userInst, user, passsalt, data, result; return _regenerator2.default.wrap(function _callee5$(_context5) { while (1) { @@ -512,7 +512,7 @@ var userController = function (_baseController) { }, { key: 'reg', value: function () { - var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) { + var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) { var userInst, params, checkRepeat, passsalt, data, user; return _regenerator2.default.wrap(function _callee6$(_context6) { while (1) { @@ -636,7 +636,7 @@ var userController = function (_baseController) { }, { key: 'list', value: function () { - var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) { + var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) { var page, limit, userInst, user, count; return _regenerator2.default.wrap(function _callee7$(_context7) { while (1) { @@ -694,7 +694,7 @@ var userController = function (_baseController) { }, { key: 'findById', value: function () { - var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) { + var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) { var userInst, id, result; return _regenerator2.default.wrap(function _callee8$(_context8) { while (1) { @@ -770,7 +770,7 @@ var userController = function (_baseController) { }, { key: 'del', value: function () { - var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) { + var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) { var userInst, id, result; return _regenerator2.default.wrap(function _callee9$(_context9) { while (1) { @@ -846,7 +846,7 @@ var userController = function (_baseController) { }, { key: 'update', value: function () { - var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) { + var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) { var params, userInst, id, data, checkRepeat, result; return _regenerator2.default.wrap(function _callee10$(_context10) { while (1) { @@ -952,7 +952,7 @@ var userController = function (_baseController) { }, { key: 'uploadAvatar', value: function () { - var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) { + var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) { var basecode, pngPrefix, jpegPrefix, type, strLength, avatarInst, result; return _regenerator2.default.wrap(function _callee11$(_context11) { while (1) { @@ -1054,7 +1054,7 @@ var userController = function (_baseController) { }, { key: 'avatar', value: function () { - var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx) { + var _ref12 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee12(ctx) { var uid, avatarInst, data, dataBuffer, type; return _regenerator2.default.wrap(function _callee12$(_context12) { while (1) { @@ -1118,7 +1118,7 @@ var userController = function (_baseController) { }, { key: 'search', value: function () { - var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(ctx) { + var _ref13 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee13(ctx) { var q, queryList, rules, filteredRes; return _regenerator2.default.wrap(function _callee13$(_context13) { while (1) { @@ -1190,7 +1190,7 @@ var userController = function (_baseController) { }, { key: 'project', value: function () { - var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(ctx) { + var _ref14 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee14(ctx) { var _ctx$request$query, id, type, result, interfaceInst, interfaceData, projectInst, projectData, ownerAuth, devAuth, groupInst, groupData, _ownerAuth, _devAuth; return _regenerator2.default.wrap(function _callee14$(_context14) { diff --git a/server_dist/middleware/mockServer.js b/server_dist/middleware/mockServer.js index 32d3e604..245b5999 100644 --- a/server_dist/middleware/mockServer.js +++ b/server_dist/middleware/mockServer.js @@ -47,7 +47,7 @@ function matchApi(apiPath, apiRule) { } module.exports = function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx, next) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) { var hostname, config, path, paths, projectId, projectInst, project, interfaceData, newData, newpath, interfaceInst, _newData, findInterface, res; return _regenerator2.default.wrap(function _callee$(_context) { diff --git a/server_dist/router.js b/server_dist/router.js index d93b4552..da6e1bc5 100644 --- a/server_dist/router.js +++ b/server_dist/router.js @@ -355,7 +355,7 @@ function createAction(controller, action, path, method) { var _this = this; router[method]("/api" + INTERFACE_CONFIG[controller].prefix + path, function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var inst; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { diff --git a/server_dist/websocket.js b/server_dist/websocket.js index d2966657..8a26b94b 100644 --- a/server_dist/websocket.js +++ b/server_dist/websocket.js @@ -26,7 +26,7 @@ function websocket(app) { return next(ctx); }); router.get('/api/interface/solve_conflict', function () { - var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) { + var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) { var inst; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { From 280dc96d9d49ad45927b34b80239c7dfb9290669 Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Tue, 29 Aug 2017 10:15:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E6=96=87=E6=A1=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/doc/api.html | 42 ++++++------- .../server/controllers/interface.js.html | 5 +- .../server/controllers/interfaceCol.js.html | 59 +++++++++++++++++-- .../static/server/controllers/project.js.html | 40 +++++++------ .../static/server/controllers/user.js.html | 2 +- 5 files changed, 101 insertions(+), 47 deletions(-) diff --git a/static/doc/api.html b/static/doc/api.html index 05e99a99..d890c991 100644 --- a/static/doc/api.html +++ b/static/doc/api.html @@ -2092,7 +2092,7 @@

源码位置: - ./server/controllers/project.js:149 + ./server/controllers/project.js:148

@@ -2176,7 +2176,7 @@

源码位置: - ./server/controllers/project.js:202 + ./server/controllers/project.js:201

@@ -2260,7 +2260,7 @@

源码位置: - ./server/controllers/project.js:265 + ./server/controllers/project.js:264

@@ -2338,7 +2338,7 @@

源码位置: - ./server/controllers/project.js:290 + ./server/controllers/project.js:289

@@ -2421,7 +2421,7 @@

源码位置: - ./server/controllers/project.js:322 + ./server/controllers/project.js:321

@@ -3032,7 +3032,7 @@

源码位置: - ./server/controllers/project.js:581 + ./server/controllers/project.js:585

@@ -3127,7 +3127,7 @@

源码位置: - ./server/controllers/project.js:635 + ./server/controllers/project.js:639

@@ -3192,7 +3192,7 @@

源码位置: - ./server/controllers/interface.js:15 + ./server/controllers/interface.js:18

@@ -3513,7 +3513,7 @@

源码位置: - ./server/controllers/interface.js:134 + ./server/controllers/interface.js:137

@@ -3578,7 +3578,7 @@

源码位置: - ./server/controllers/interface.js:159 + ./server/controllers/interface.js:162

@@ -3643,7 +3643,7 @@

源码位置: - ./server/controllers/interface.js:221 + ./server/controllers/interface.js:224

@@ -3876,7 +3876,7 @@

源码位置: - ./server/controllers/interface.js:376 + ./server/controllers/interface.js:379

@@ -4181,7 +4181,7 @@

源码位置: - ./server/controllers/interfaceCol.js:12 + ./server/controllers/interfaceCol.js:16

@@ -4243,7 +4243,7 @@

源码位置: - ./server/controllers/interfaceCol.js:37 + ./server/controllers/interfaceCol.js:41

@@ -4329,7 +4329,7 @@

源码位置: - ./server/controllers/interfaceCol.js:94 + ./server/controllers/interfaceCol.js:98

@@ -4391,7 +4391,7 @@

源码位置: - ./server/controllers/interfaceCol.js:116 + ./server/controllers/interfaceCol.js:128

@@ -4573,7 +4573,7 @@

源码位置: - ./server/controllers/interfaceCol.js:192 + ./server/controllers/interfaceCol.js:208

@@ -4743,7 +4743,7 @@

源码位置: - ./server/controllers/interfaceCol.js:259 + ./server/controllers/interfaceCol.js:277

@@ -4805,7 +4805,7 @@

源码位置: - ./server/controllers/interfaceCol.js:280 + ./server/controllers/interfaceCol.js:327

@@ -4879,7 +4879,7 @@

源码位置: - ./server/controllers/interfaceCol.js:321 + ./server/controllers/interfaceCol.js:368

@@ -4939,7 +4939,7 @@

源码位置: - ./server/controllers/interfaceCol.js:363 + ./server/controllers/interfaceCol.js:410

diff --git a/static/doc/static/server/controllers/interface.js.html b/static/doc/static/server/controllers/interface.js.html index a0bf1943..de099954 100644 --- a/static/doc/static/server/controllers/interface.js.html +++ b/static/doc/static/server/controllers/interface.js.html @@ -27,6 +27,8 @@
                 import interfaceModel from '../models/interface.js';
 import interfaceCatModel from '../models/interfaceCat.js';
+import interfaceCaseModel from '../models/interfaceCase.js'
+
 import baseController from './base.js';
 import yapi from '../yapi.js';
 import userModel from '../models/user.js';
@@ -38,6 +40,7 @@ class interfaceController extends baseController {
         this.Model = yapi.getInst(interfaceModel);
         this.catModel = yapi.getInst(interfaceCatModel);
         this.projectModel = yapi.getInst(projectModel);
+        this.caseModel = yapi.getInst(interfaceCaseModel);
     }
 
     /**
@@ -431,7 +434,7 @@ class interfaceController extends baseController {
 
             let inter = await this.Model.get(id);
             let result = await this.Model.del(id);
-
+            await this.caseModel.delByInterfaceId(id);
             let username = this.getUsername();
             this.catModel.get(inter.catid).then((cate)=>{
                 yapi.commons.saveLog({
diff --git a/static/doc/static/server/controllers/interfaceCol.js.html b/static/doc/static/server/controllers/interfaceCol.js.html
index b1063703..ec7a7c0c 100644
--- a/static/doc/static/server/controllers/interfaceCol.js.html
+++ b/static/doc/static/server/controllers/interfaceCol.js.html
@@ -27,6 +27,8 @@
                 
                 import interfaceColModel from '../models/interfaceCol.js';
 import interfaceCaseModel from '../models/interfaceCase.js';
+import interfaceModel from '../models/interface.js';
+import projectModel from '../models/project.js';
 import baseController from './base.js';
 import yapi from '../yapi.js';
 
@@ -35,6 +37,8 @@ class interfaceColController extends baseController{
         super(ctx);
         this.colModel = yapi.getInst(interfaceColModel);
         this.caseModel = yapi.getInst(interfaceCaseModel);
+        this.interfaceModel = yapi.getInst(interfaceModel);
+        this.projectModel = yapi.getInst(projectModel);
     }
 
     /**
@@ -135,6 +139,14 @@ class interfaceColController extends baseController{
             let id = ctx.query.col_id;
             let inst = yapi.getInst(interfaceCaseModel);
             let result = await inst.list(id, 'all');
+            for(let index=0; index< result.length; index++){
+                
+                result[index] = result[index].toObject();
+                let interfaceData = await this.interfaceModel.getBaseinfo(result[index].interface_id);
+                let projectData = await this.projectModel.getBaseInfo(interfaceData.project_id);
+                result[index].path = projectData.basepath +  interfaceData.path;
+                result[index].method = interfaceData.method;
+            }
             ctx.body = yapi.commons.resReturn(result);
         } catch (e) {
             ctx.body = yapi.commons.resReturn(null, 402, e.message);
@@ -169,8 +181,8 @@ class interfaceColController extends baseController{
                 casename: 'string',
                 project_id: 'number',
                 col_id: 'number',
-                domain: 'string',
-                method: 'string'
+                interface_id: 'number',
+                case_env: 'string'
             });
 
 
@@ -178,7 +190,11 @@ class interfaceColController extends baseController{
                 return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
             }
 
-            let auth = await this.checkAuth(params.project_id, 'project', 'edit')
+            if(!params.interface_id){
+                return ctx.body = yapi.commons.resReturn(null, 400, '接口id不能为空');
+            }
+
+            let auth = await this.checkAuth(params.project_id, 'project', 'edit');
             if (!auth) {
                 return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
             }
@@ -242,9 +258,7 @@ class interfaceColController extends baseController{
             let params = ctx.request.body;
             params = yapi.commons.handleParams(params, {
                 id: 'number',
-                casename: 'string',
-                domain: 'string',
-                method: 'string'
+                casename: 'string'
             });
 
             if (!params.id) {
@@ -263,6 +277,10 @@ class interfaceColController extends baseController{
 
             params.uid = this.getUid();
 
+            delete params.interface_id;
+            delete params.project_id;
+            delete params.col_id;
+
             let result = await this.caseModel.up(params.id, params);
             let username = this.getUsername();
             this.colModel.get(caseData.col_id).then((col)=>{
@@ -299,12 +317,41 @@ class interfaceColController extends baseController{
         try{
             let id = ctx.query.caseid;
             let result = await this.caseModel.get(id);
+            if(!result){
+                return ctx.body = yapi.commons.resReturn(null, 400, '不存在的case');
+            }
+            result = result.toObject();
+            let data = await this.interfaceModel.get(result.interface_id);
+            let projectData = await this.projectModel.getBaseInfo(data.project_id);
+            result.path = projectData.basepath + data.path;
+            result.method = data.method;
+            result.req_body_type = data.req_body_type;
+            result.req_headers = data.req_headers;
+
+            result.req_body_form = this.handleParamsValue(data.req_body_form, result.req_body_form)
+            result.req_query = this.handleParamsValue(data.req_query, result.req_query)
+            result.req_params = this.handleParamsValue(data.req_params, result.req_params)
+
             ctx.body = yapi.commons.resReturn(result);
         }catch(e){
             ctx.body = yapi.commons.resReturn(null, 400, e.message)
         }
     }
 
+    handleParamsValue(params, val){
+        let value = {};
+        if(params.length === 0 || val.length === 0){
+            return params;
+        }
+        val.forEach((item, index)=>{
+            value[item.name] = item;
+        })
+        params.forEach((item, index)=>{
+            params[index].value = value[item.name].value;
+        })
+        return params;
+    }
+
     /**
      * 更新一个接口集name或描述
      * @interface /col/up_col
diff --git a/static/doc/static/server/controllers/project.js.html b/static/doc/static/server/controllers/project.js.html
index 338b0d42..2b194681 100644
--- a/static/doc/static/server/controllers/project.js.html
+++ b/static/doc/static/server/controllers/project.js.html
@@ -165,8 +165,7 @@ class projectController extends baseController {
                 type: 'project',
                 uid: this.getUid(),
                 username: username,
-                typeid: params.group_id,
-                typename: params.group_name
+                typeid: params.group_id
             });
             ctx.body = yapi.commons.resReturn(result);
         } catch (e) {
@@ -359,7 +358,7 @@ class projectController extends baseController {
      */
 
     async list(ctx) {
-        let group_id = ctx.request.query.group_id
+        let group_id = ctx.request.query.group_id, project_list = [];
 
         if (!group_id) {
             return ctx.body = yapi.commons.resReturn(null, 400, '项目分组id不能为空');
@@ -367,30 +366,31 @@ class projectController extends baseController {
 
         let auth = await this.checkAuth(group_id, 'group', 'edit')
         try {
-            let result = await this.Model.list(group_id, auth);
+            let result = await this.Model.list(group_id);
             let follow = await this.followModel.list(this.getUid());
-            let uids = [];
-            result.forEach((item, index) => {
-                result[index] = item.toObject();
+            for(let index=0, item, r =  1; index< result.length; index++){
+                item = result[index].toObject();
+                if(item.project_type === 'private' && auth === false){
+                    r = await this.Model.checkMemberRepeat(this.getUid());
+                    if(r === 0){
+                        continue;
+                    }
+                }
+                
                 let f = _.find(follow, (fol) => {
                     return fol.projectid === item._id
                 })
                 if (f) {
-                    result[index].follow = true;
+                    item.follow = true;
                 } else {
-                    result[index].follow = false;
-                }
-                if (uids.indexOf(item.uid) === -1) {
-                    uids.push(item.uid);
+                    item.follow = false;
                 }
+                project_list.push(item);
+
+            };
 
-            });
-            let _users = {}, users = await yapi.getInst(userModel).findByUids(uids);
-            users.forEach((item) => {
-                _users[item._id] = item;
-            });
             ctx.body = yapi.commons.resReturn({
-                list: result
+                list: project_list
             });
         } catch (e) {
             ctx.body = yapi.commons.resReturn(null, 402, e.message);
@@ -579,9 +579,13 @@ class projectController extends baseController {
                 }
             }
 
+
             let data = {
                 up_time: yapi.commons.time()
             };
+            if(params.project_type){
+                data.project_type = params.project_type
+            }
 
             if (params.name) data.name = params.name;
             if (params.desc) data.desc = params.desc;
diff --git a/static/doc/static/server/controllers/user.js.html b/static/doc/static/server/controllers/user.js.html
index f2a57a5b..3a896902 100644
--- a/static/doc/static/server/controllers/user.js.html
+++ b/static/doc/static/server/controllers/user.js.html
@@ -175,7 +175,7 @@ class userController extends baseController {
                 user = await userInst.save(data);
                 yapi.commons.sendMail({
                     to: email,
-                    contents: `

亲爱的用户:

您好,感谢使用YApi平台.

` + contents: `

亲爱的用户:

您好,感谢使用YApi平台,你的邮箱账号是:${email}

` }); }