(ctx, next)
| 18 | } |
| 19 | |
| 20 | async avatarInfo(ctx, next) { |
| 21 | // 1.用户的头像是哪一个文件呢? |
| 22 | const { userId } = ctx.params; |
| 23 | const avatarInfo = await fileService.getAvatarByUserId(userId); |
| 24 | |
| 25 | // 2.提供图像信息 |
| 26 | ctx.response.set('content-type', avatarInfo.mimetype); |
| 27 | ctx.body = fs.createReadStream(`${AVATAR_PATH}/${avatarInfo.filename}`); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | module.exports = new UserController(); |
nothing calls this directly
no test coverage detected