Browse Source

用户创建

release_0.0.1
巴林闲侠 3 years ago
parent
commit
778d0a2a1c
  1. 12
      api/app/lib/controllers/organization/user.js
  2. 2
      api/app/lib/models/user.js
  3. 3
      api/log/development.log

12
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,

2
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,

3
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.

Loading…
Cancel
Save