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 5349bd11..13e9708f 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 26827ede..6c42bc44 100644 --- a/server_dist/controllers/interface.js +++ b/server_dist/controllers/interface.js @@ -110,7 +110,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; @@ -278,7 +278,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) { @@ -340,7 +340,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) { @@ -390,7 +390,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) { @@ -440,7 +440,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) { @@ -545,7 +545,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; @@ -752,7 +752,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; @@ -849,7 +849,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; @@ -932,7 +932,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) { @@ -1027,7 +1027,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) { @@ -1099,7 +1099,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 f149ec51..ce6c3ef9 100644 --- a/server_dist/controllers/interfaceCol.js +++ b/server_dist/controllers/interfaceCol.js @@ -84,7 +84,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) { @@ -159,7 +159,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) { @@ -265,7 +265,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, index, interfaceData, projectData; return _regenerator2.default.wrap(function _callee3$(_context3) { while (1) { @@ -357,7 +357,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; @@ -494,7 +494,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; @@ -609,7 +609,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, data, projectData; return _regenerator2.default.wrap(function _callee6$(_context6) { while (1) { @@ -707,7 +707,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) { @@ -792,7 +792,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; @@ -861,7 +861,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) { @@ -947,7 +947,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/project.js b/server_dist/controllers/project.js index bfce8105..aca4a9ba 100644 --- a/server_dist/controllers/project.js +++ b/server_dist/controllers/project.js @@ -148,7 +148,7 @@ var projectController = function (_baseController) { }, { 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 params, checkRepeat, data, result, colInst, catInst, username; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { @@ -320,7 +320,7 @@ var projectController = function (_baseController) { }, { key: 'addMember', 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, check, userdata, result, username; return _regenerator2.default.wrap(function _callee2$(_context2) { while (1) { @@ -443,7 +443,7 @@ var projectController = function (_baseController) { }, { key: 'delMember', 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 _this2 = this; var params, check, result, username; @@ -541,7 +541,7 @@ var projectController = function (_baseController) { }, { key: 'getUserdata', value: function () { - var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(uid, role) { + var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(uid, role) { var userInst, userData; return _regenerator2.default.wrap(function _callee4$(_context4) { while (1) { @@ -599,7 +599,7 @@ var projectController = function (_baseController) { }, { key: 'getMemberList', 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, project; return _regenerator2.default.wrap(function _callee5$(_context5) { while (1) { @@ -661,7 +661,7 @@ var projectController = function (_baseController) { }, { key: 'get', 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, result, catInst, cat; return _regenerator2.default.wrap(function _callee6$(_context6) { while (1) { @@ -746,7 +746,7 @@ var projectController = 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 _this3 = this; var group_id, project_list, auth, result, follow, _loop, index, item, r, _ret; @@ -781,7 +781,7 @@ var projectController = function (_baseController) { case 12: follow = _context8.sent; - _loop = /*#__PURE__*/_regenerator2.default.mark(function _loop(index, _item, _r) { + _loop = _regenerator2.default.mark(function _loop(index, _item, _r) { var f; return _regenerator2.default.wrap(function _loop$(_context7) { while (1) { @@ -898,7 +898,7 @@ var projectController = function (_baseController) { }, { key: 'del', 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 id, interfaceInst, interfaceColInst, interfaceCaseInst, result; return _regenerator2.default.wrap(function _callee8$(_context9) { while (1) { @@ -991,7 +991,7 @@ var projectController = function (_baseController) { }, { key: 'changeMemberRole', 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 _this4 = this; var params, projectInst, check, result, username; @@ -1107,7 +1107,7 @@ var projectController = function (_baseController) { }, { key: 'upSet', 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 id, data, result; @@ -1197,7 +1197,7 @@ var projectController = 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 id, params, projectData, checkRepeat, data, result, username; return _regenerator2.default.wrap(function _callee11$(_context12) { while (1) { @@ -1346,7 +1346,7 @@ var projectController = function (_baseController) { }, { key: 'search', 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 q, projectList, groupList, projectRules, groupRules, queryList; return _regenerator2.default.wrap(function _callee12$(_context13) { while (1) { @@ -1421,7 +1421,7 @@ var projectController = function (_baseController) { }, { key: 'download', 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 project_id, interfaceInst, count, arr, fileName, res; return _regenerator2.default.wrap(function _callee13$(_context14) { while (1) { diff --git a/server_dist/controllers/user.js b/server_dist/controllers/user.js index 17afc34e..e147d068 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) { 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}
` }); }