Jelajahi Sumber

修改管理员账号名同步到项目表里

laiguoran 2 tahun lalu
induk
melakukan
cf533f7eb0
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      app/service/project_account.js

+ 4 - 0
app/service/project_account.js

@@ -601,6 +601,10 @@ module.exports = app => {
                     const sqlParam = [this.tableName, account, encryptPassword, accountId, 'SSO password'];
                     const operate = await this.transaction.query(sql, sqlParam);
                     result = operate.affectedRows > 0;
+                    // 判断账号是否为管理员,则同步更新到项目表里
+                    if (accountData.is_admin) {
+                        await this.transaction.update(this.ctx.service.project.tableName, { id: accountData.project_id, user_account: account });
+                    }
                 } else {
                     const sql = 'UPDATE ?? SET password=? WHERE id=? AND password != ?;';
                     const sqlParam = [this.tableName, encryptPassword, accountId, 'SSO password'];