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

This commit is contained in:
zwjamnsss 2017-08-29 10:21:02 +08:00
commit f340684651
21 changed files with 185 additions and 128 deletions

View File

@ -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';

View File

@ -46,7 +46,7 @@ class InterfaceEdit extends Component {
message.success('保存成功');
this.props.switchToView()
} else {
message.success(result.data.errmsg)
message.error(result.data.errmsg)
}
}

View File

@ -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: '输入接口名称!'
}]
})(
<Input placeholder="接口名称" />

View File

@ -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();
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -2092,7 +2092,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#149" target="_blank">./server/controllers/project.js:149</a>
<a href="./static/server/controllers/project.js.html#148" target="_blank">./server/controllers/project.js:148</a>
</p>
@ -2176,7 +2176,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#202" target="_blank">./server/controllers/project.js:202</a>
<a href="./static/server/controllers/project.js.html#201" target="_blank">./server/controllers/project.js:201</a>
</p>
@ -2260,7 +2260,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#265" target="_blank">./server/controllers/project.js:265</a>
<a href="./static/server/controllers/project.js.html#264" target="_blank">./server/controllers/project.js:264</a>
</p>
@ -2338,7 +2338,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#290" target="_blank">./server/controllers/project.js:290</a>
<a href="./static/server/controllers/project.js.html#289" target="_blank">./server/controllers/project.js:289</a>
</p>
@ -2421,7 +2421,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#322" target="_blank">./server/controllers/project.js:322</a>
<a href="./static/server/controllers/project.js.html#321" target="_blank">./server/controllers/project.js:321</a>
</p>
@ -3032,7 +3032,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#581" target="_blank">./server/controllers/project.js:581</a>
<a href="./static/server/controllers/project.js.html#585" target="_blank">./server/controllers/project.js:585</a>
</p>
@ -3127,7 +3127,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/project.js.html#635" target="_blank">./server/controllers/project.js:635</a>
<a href="./static/server/controllers/project.js.html#639" target="_blank">./server/controllers/project.js:639</a>
</p>
@ -3192,7 +3192,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interface.js.html#15" target="_blank">./server/controllers/interface.js:15</a>
<a href="./static/server/controllers/interface.js.html#18" target="_blank">./server/controllers/interface.js:18</a>
</p>
@ -3513,7 +3513,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interface.js.html#134" target="_blank">./server/controllers/interface.js:134</a>
<a href="./static/server/controllers/interface.js.html#137" target="_blank">./server/controllers/interface.js:137</a>
</p>
@ -3578,7 +3578,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interface.js.html#159" target="_blank">./server/controllers/interface.js:159</a>
<a href="./static/server/controllers/interface.js.html#162" target="_blank">./server/controllers/interface.js:162</a>
</p>
@ -3643,7 +3643,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interface.js.html#221" target="_blank">./server/controllers/interface.js:221</a>
<a href="./static/server/controllers/interface.js.html#224" target="_blank">./server/controllers/interface.js:224</a>
</p>
@ -3876,7 +3876,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interface.js.html#376" target="_blank">./server/controllers/interface.js:376</a>
<a href="./static/server/controllers/interface.js.html#379" target="_blank">./server/controllers/interface.js:379</a>
</p>
@ -4181,7 +4181,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#12" target="_blank">./server/controllers/interfaceCol.js:12</a>
<a href="./static/server/controllers/interfaceCol.js.html#16" target="_blank">./server/controllers/interfaceCol.js:16</a>
</p>
@ -4243,7 +4243,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#37" target="_blank">./server/controllers/interfaceCol.js:37</a>
<a href="./static/server/controllers/interfaceCol.js.html#41" target="_blank">./server/controllers/interfaceCol.js:41</a>
</p>
@ -4329,7 +4329,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#94" target="_blank">./server/controllers/interfaceCol.js:94</a>
<a href="./static/server/controllers/interfaceCol.js.html#98" target="_blank">./server/controllers/interfaceCol.js:98</a>
</p>
@ -4391,7 +4391,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#116" target="_blank">./server/controllers/interfaceCol.js:116</a>
<a href="./static/server/controllers/interfaceCol.js.html#128" target="_blank">./server/controllers/interfaceCol.js:128</a>
</p>
@ -4573,7 +4573,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#192" target="_blank">./server/controllers/interfaceCol.js:192</a>
<a href="./static/server/controllers/interfaceCol.js.html#208" target="_blank">./server/controllers/interfaceCol.js:208</a>
</p>
@ -4743,7 +4743,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#259" target="_blank">./server/controllers/interfaceCol.js:259</a>
<a href="./static/server/controllers/interfaceCol.js.html#277" target="_blank">./server/controllers/interfaceCol.js:277</a>
</p>
@ -4805,7 +4805,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#280" target="_blank">./server/controllers/interfaceCol.js:280</a>
<a href="./static/server/controllers/interfaceCol.js.html#327" target="_blank">./server/controllers/interfaceCol.js:327</a>
</p>
@ -4879,7 +4879,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#321" target="_blank">./server/controllers/interfaceCol.js:321</a>
<a href="./static/server/controllers/interfaceCol.js.html#368" target="_blank">./server/controllers/interfaceCol.js:368</a>
</p>
@ -4939,7 +4939,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/interfaceCol.js.html#363" target="_blank">./server/controllers/interfaceCol.js:363</a>
<a href="./static/server/controllers/interfaceCol.js.html#410" target="_blank">./server/controllers/interfaceCol.js:410</a>
</p>

View File

@ -27,6 +27,8 @@
<pre class="brush: js;">
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({

View File

@ -27,6 +27,8 @@
<pre class="brush: js;">
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

View File

@ -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;

View File

@ -175,7 +175,7 @@ class userController extends baseController {
user = await userInst.save(data);
yapi.commons.sendMail({
to: email,
contents: `<h3>亲爱的用户:</h3><p>您好感谢使用YApi平台.</p>`
contents: `<h3>亲爱的用户:</h3><p>您好感谢使用YApi平台,你的邮箱账号是:${email}</p>`
});
}