From 874d333df9341f1bf6596d48f8a7e4b75881db57 Mon Sep 17 00:00:00 2001 From: lwg Date: Thu, 6 Jul 2017 19:56:45 +0800 Subject: [PATCH] user --- server/router.js | 9 +++++++ server_dist/controllers/group.js | 36 +--------------------------- server_dist/models/group.js | 40 ++------------------------------ 3 files changed, 12 insertions(+), 73 deletions(-) diff --git a/server/router.js b/server/router.js index ff6de5d6..decc334d 100644 --- a/server/router.js +++ b/server/router.js @@ -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') diff --git a/server_dist/controllers/group.js b/server_dist/controllers/group.js index 700b93be..ad08d69f 100644 --- a/server_dist/controllers/group.js +++ b/server_dist/controllers/group.js @@ -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]]); })); diff --git a/server_dist/models/group.js b/server_dist/models/group.js index 39b2f204..2cd5ad2b 100644 --- a/server_dist/models/group.js +++ b/server_dist/models/group.js @@ -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, [{