Browse Source

pcode判重修改

master
wenlele 9 months ago
parent
commit
8df04e62a9
  1. 10
      api/app/lib/controllers/projectManagement/projectPublish.js

10
api/app/lib/controllers/projectManagement/projectPublish.js

@ -57,7 +57,7 @@ async function postProjectPublish (ctx, next) {
try {
const models = ctx.fs.dc.models
const data = ctx.request.body
const { id, password, projectName, replacement } = data
const { id, password, projectName, replacement, isCode, code } = data
let findOne = await models.ProjectUser.findOne({ where: { projectName } })
if ((!id && findOne) || (findOne && findOne.id != id)) {
@ -65,6 +65,14 @@ async function postProjectPublish (ctx, next) {
throw ''
}
if (isCode) {
let codeOne = await models.ProjectUser.findOne({ where: { code } })
if (codeOne) {
message = 'pcode重复'
throw ''
}
}
if (replacement) {
let pass = Hex.stringify(MD5(password));
await models.ProjectUser.update({ password: pass, }, { where: { id } })

Loading…
Cancel
Save