Skip to content

Commit

Permalink
fix: 修复预置函数 admin-edit 的标识错误;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Aug 6, 2021
1 parent 05704ea commit 96f588e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions packages/devops-server/init/functions/admin-edit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import * as crypto from 'crypto'
const db = cloud.database()

exports.main = async function (ctx) {
console.log(ctx)

const uid = ctx.auth?.uid
if (!uid) {
return 'Unauthorized'
Expand Down Expand Up @@ -40,7 +42,7 @@ exports.main = async function (ctx) {
// update password
if (password) {
await db.collection('password')
.where({ uid: uid })
.where({ uid: _id })
.update({
password: hashPassword(password),
updated_at: Date.now()
Expand Down Expand Up @@ -78,13 +80,14 @@ exports.main = async function (ctx) {
data['roles'] = roles
}

console.log(_id, data)
const r = await db.collection('admins')
.where({ _id: uid })
.where({ _id: _id })
.update(data)

return {
...r,
uid
_id
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/devops-server/init/functions/admin-edit/meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "后台管理-创建管理员",
"name": "admin-create",
"label": "后台管理-编辑管理员",
"name": "admin-edit",
"description": "",
"enableHTTP": true,
"tags": ["后台管理", "预置"]
Expand Down

0 comments on commit 96f588e

Please sign in to comment.