We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26da60e commit 5b91593Copy full SHA for 5b91593
app/controller/user.js
@@ -4,10 +4,12 @@ const Controller = require('egg').Controller;
4
5
class UserController extends Controller {
6
async index() {
7
- const { ctx } = this;
+ const { ctx, ctx: { service: { mysql } } } = this;
8
const { nick, userId } = ctx.user;
9
10
- ctx.body = { ok: true, data: { name: nick, id: userId } };
+ const [{ identity }] = await mysql.getUserByUserIds([userId]);
11
+
12
+ ctx.body = { ok: true, data: { name: nick, id: identity } };
13
}
14
15
0 commit comments