From 778d0a2a1c258d45a50bc514ed47ad1fc46caa35 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 22 Jul 2022 08:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/user.js | 12 ++++++------ api/app/lib/models/user.js | 2 +- api/log/development.log | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/app/lib/controllers/organization/user.js b/api/app/lib/controllers/organization/user.js index 4b7ecb70..1028be9b 100644 --- a/api/app/lib/controllers/organization/user.js +++ b/api/app/lib/controllers/organization/user.js @@ -11,7 +11,7 @@ async function getUser (ctx, next) { departmentId: parseInt(depId), delete: false }, - attributes: { exclude: ['password', 'delete'] }, + attributes: { exclude: ['password', 'delete', 'username'] }, order: [['id', 'asc']], }) @@ -33,7 +33,7 @@ async function getUserAll (ctx, next) { where: { delete: false }, - attributes: { exclude: ['password', 'delete'] }, + attributes: { exclude: ['password', 'delete', 'username'] }, order: [['id', 'asc']], }) @@ -55,7 +55,7 @@ async function creatUser (ctx, next) { let repeatUserNameCount = await models.User.count({ where: { - username: data.username, + phone: data.phone, delete: false } }) @@ -66,7 +66,7 @@ async function creatUser (ctx, next) { await models.User.create({ name: data.name, - username: data.username, + // username: data.username, password: Hex.stringify(MD5(data.password)), departmentId: data.departmentId, email: data.email, @@ -96,7 +96,7 @@ async function updateUser (ctx, next) { let repeatUserNameCount = await models.User.count({ where: { - username: data.username, + phone: data.phone, delete: false, id: { $ne: userId } } @@ -108,7 +108,7 @@ async function updateUser (ctx, next) { await models.User.update({ name: data.name, - username: data.username, + // username: data.username, departmentId: data.departmentId, email: data.email, enable: data.enable, diff --git a/api/app/lib/models/user.js b/api/app/lib/models/user.js index e699b523..dbef784d 100644 --- a/api/app/lib/models/user.js +++ b/api/app/lib/models/user.js @@ -25,7 +25,7 @@ module.exports = dc => { }, username: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, defaultValue: null, comment: null, primaryKey: false, diff --git a/api/log/development.log b/api/log/development.log index ddab91d4..d3a07473 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -7147,3 +7147,6 @@ 2022-07-21 20:10:08.705 - info: [FS-AUTH] Inject auth and api mv into router. 2022-07-21 20:10:18.909 - error: path: /report, error: SequelizeValidationError: notNull Violation: report.userId cannot be null 2022-07-21 20:10:26.541 - error: path: /report, error: SequelizeValidationError: notNull Violation: report.userId cannot be null +2022-07-21 20:46:20.452 - debug: [FS-LOGGER] Init. +2022-07-21 20:46:20.547 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-21 20:46:20.547 - info: [FS-AUTH] Inject auth and api mv into router.