This commit is contained in:
lwg 2017-07-06 19:56:45 +08:00
parent e2e4b7f7dc
commit 874d333df9
3 changed files with 12 additions and 73 deletions

View File

@ -1,6 +1,7 @@
import koaRouter from 'koa-router'
import interfaceController from './controllers/interface.js'
import groupController from './controllers/group.js'
import userController from './controllers/user.js'
import yapi from './yapi.js'
import projectController from './controllers/project.js'
@ -33,6 +34,14 @@ createAction('group', 'add', 'post', 'add')
createAction('group', 'up', 'post', 'up')
createAction('group', 'del', 'post', 'del')
//user
createAction('user', 'login', 'post', 'login')
createAction('user', 'reg', 'post', 'reg')
createAction('user', 'list', 'get', 'list')
createAction('user', 'getUser', 'get', 'getUser')
createAction('user', 'update', 'post', 'update')
createAction('user', 'del', 'post', 'del')
//project
createAction('project', 'add', 'post', 'add')

View File

@ -146,41 +146,7 @@ var groupController = function (_baseController) {
return _context.stop();
}
}
<<<<<<< HEAD
}
}, _callee, _this, [[9, 17]]);
}))();
},
list: function list(ctx) {
var _this2 = this;
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2() {
var result;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.prev = 0;
_context2.next = 3;
return _group2.default.list();
case 3:
result = _context2.sent;
ctx.body = _yapi2.default.commons.resReturn(result);
_context2.next = 10;
break;
case 7:
_context2.prev = 7;
_context2.t0 = _context2['catch'](0);
//会不会有问题 err e.message
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
case 10:
case 'end':
return _context2.stop();
=======
}, _callee, this, [[10, 18]]);
}));
@ -221,7 +187,7 @@ var groupController = function (_baseController) {
case 'end':
return _context2.stop();
}
>>>>>>> dev
}
}, _callee2, this, [[0, 8]]);
}));

View File

@ -34,51 +34,15 @@ var _base2 = _interopRequireDefault(_base);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
<<<<<<< HEAD
var groupSchema = {
uid: String,
group_name: String,
group_desc: String,
add_time: Number,
up_time: Number
};
var groupModel = _yapi2.default.db('group', groupSchema);
module.exports = {
save: function save(data) {
var m = new groupModel(data);
return m.save();
},
checkRepeat: function checkRepeat(name) {
return groupModel.count({
group_name: name
});
},
list: function list() {
return groupModel.find().select("group_name _id group_name group_desc add_time up_time").exec(); //增加了group_name
},
del: function del(id) {
return groupModel.deleteOne({
_id: id
});
},
up: function up(id, data) {
return groupModel.update({
_id: id
}, {
group_name: data.group_name,
group_desc: data.group_desc,
up_time: _yapi2.default.commons.time()
});
=======
var groupModel = function (_baseModel) {
(0, _inherits3.default)(groupModel, _baseModel);
function groupModel() {
(0, _classCallCheck3.default)(this, groupModel);
return (0, _possibleConstructorReturn3.default)(this, (groupModel.__proto__ || (0, _getPrototypeOf2.default)(groupModel)).apply(this, arguments));
>>>>>>> dev
}
(0, _createClass3.default)(groupModel, [{