diff --git a/api/app/lib/controllers/projectManagement/projectPublish.js b/api/app/lib/controllers/projectManagement/projectPublish.js index 91d57f4..b7efeec 100644 --- a/api/app/lib/controllers/projectManagement/projectPublish.js +++ b/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 } })