明树Git Lab

Commit 1e1e2fdd authored by zfp1's avatar zfp1

update

parent 14a5acc9
Pipeline #108216 passed with stage
in 3 seconds
......@@ -48,7 +48,7 @@ async function updateRole(req, res, next) {
}
// sequelize 只有update 写时需要注意条件 不能为空
if(role.key != req.body.key) {
let rt = await DB.Role.findOne({where: {key: req.body.key}});
let rt = await DB.Role.findOne({where: {key: req.body.key, del: 0}});
if(rt) {
return res.sendError(errorMessage.roleDuplicate);
}
......
......@@ -161,11 +161,12 @@ async function createUser(req, res, next) {
body.password = passwordHash;
const checkMobile = await DB.User.findOne({
where: {
mobile: body.mobile
mobile: body.mobile,
del: 0
}
});
if (checkMobile) {
return res.sendError(errorMessage.nameDuplicated)
return res.sendError(errorMessage.mobileDuplicate)
}
const ret = await DB.User.create(body);
if (!(ret && ret.id)) {
......@@ -281,7 +282,7 @@ async function updateUser(req, res, next) {
}
//
if(user.mobile != req.body.mobile) {
let mt = await DB.User.findOne({where: {mobile: req.body.mobile}});
let mt = await DB.User.findOne({where: {mobile: req.body.mobile, del: 0}});
if(mt) {
return res.sendError(errorMessage.mobileDuplicate)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment