From 6014f8b5246aedaedf9ca6f11e2baf56fbe664de Mon Sep 17 00:00:00 2001 From: lwg Date: Tue, 11 Jul 2017 10:17:44 +0800 Subject: [PATCH] user --- package.json | 1 + server/controllers/user.js | 2 +- server/models/user.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index be2d3825..fbc4d378 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "mongoose": "4.10.8", "mongoose-auto-increment": "^5.0.1", "node-sass-china": "^4.5.0", + "sha1": "^1.1.1", "redux": "^3.7.1", "ykit-config-antd": "^0.1.3", "ykit-config-react": "^0.4.4" diff --git a/server/controllers/user.js b/server/controllers/user.js index 3b9a0742..b3c55538 100644 --- a/server/controllers/user.js +++ b/server/controllers/user.js @@ -61,7 +61,7 @@ class userController extends baseController{ async reg(ctx){ //注册 var userInst = yapi.getInst(userModel); let params = ctx.request.body; //获取请求的参数,检查是否存在用户名和密码 - let result = await userInst.findByName(params.username); + //let result = await userInst.findByName(params.username); if(!params.username){ return ctx.body = yapi.commons.resReturn(null,400,'用户名不能为空'); } diff --git a/server/models/user.js b/server/models/user.js index bf527d3f..08cea1c9 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -50,12 +50,12 @@ class userModel extends baseModel{ } del (id) { return this.model.deleteOne({ - _id: id + _id: id }) } update(id,data){ return this.model.update({ - _id: id, + _id: id },{ username: data.username, password: data.password,