diff --git a/docs/source/en/basics/service.md b/docs/source/en/basics/service.md index a25e9beb1b..404f35941e 100644 --- a/docs/source/en/basics/service.md +++ b/docs/source/en/basics/service.md @@ -75,6 +75,7 @@ module.exports = app => { const Controller = require('egg').Controller; class UserController extends Controller { async info() { + const { ctx } = this; const userId = ctx.params.id; const userInfo = await ctx.service.user.find(userId); ctx.body = userInfo; diff --git a/docs/source/zh-cn/basics/service.md b/docs/source/zh-cn/basics/service.md index 608fc5b3bb..1f31689395 100644 --- a/docs/source/zh-cn/basics/service.md +++ b/docs/source/zh-cn/basics/service.md @@ -75,6 +75,7 @@ module.exports = app => { const Controller = require('egg').Controller; class UserController extends Controller { async info() { + const { ctx } = this; const userId = ctx.params.id; const userInfo = await ctx.service.user.find(userId); ctx.body = userInfo;