Skip to content

Commit 5b91593

Browse files
committed
fix: wrong identity id
1 parent 26da60e commit 5b91593

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/controller/user.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ const Controller = require('egg').Controller;
44

55
class UserController extends Controller {
66
async index() {
7-
const { ctx } = this;
7+
const { ctx, ctx: { service: { mysql } } } = this;
88
const { nick, userId } = ctx.user;
99

10-
ctx.body = { ok: true, data: { name: nick, id: userId } };
10+
const [{ identity }] = await mysql.getUserByUserIds([userId]);
11+
12+
ctx.body = { ok: true, data: { name: nick, id: identity } };
1113
}
1214
}
1315

0 commit comments

Comments
 (0)